Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# EditorConfig helps maintain consistent coding styles
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
170 changes: 170 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
name: CI

on:
push:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
outputs:
sdist: ${{ steps.paths.outputs.sdist }}
wheel: ${{ steps.paths.outputs.wheel }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Build
run: |
# Build sdist and wheel artifacts from the checked-out source.
# Keep this job minimal and deterministic.
python -m pip install -U pip build
python -m build

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*

- id: paths
run: |
# Record artifact paths for downstream jobs (convenience only).
echo "sdist=$(ls dist/*.tar.gz | head -n1)" >> "$GITHUB_OUTPUT"
echo "wheel=$(ls dist/*.whl | head -n1)" >> "$GITHUB_OUTPUT"

tests:
needs: build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.10","3.11","3.12","3.13"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
# Caching will fail if there is nothing to cache
#cache: pip

- uses: actions/download-artifact@v4
with: { name: dist, path: dist }

- uses: astral-sh/setup-uv@v7

- name: Install from wheel + dev deps
run: |
# Prefer uv for speed; the tool was set up in the previous step.
# Install the built wheel so tests import the installed artifact, not the repo's src/.
uv pip install --system "${{ needs.build.outputs.wheel }}"
uv pip install --system 'pytest>=8' 'ruff>=0.6' 'mypy>=1.10' 'coverage[toml]>=7'

- run: |
mkdir -p reports

# Run tests against the installed wheel, not the source tree's `src`.
# `-c /dev/null` ignores repo pytest config (e.g., pythonpath=['src']).
python -m coverage run -m pytest -q -c /dev/null tests --junitxml=reports/junit.xml

# Export coverage for upload.
python -m coverage xml -o reports/coverage.xml

# TODO: do something with reports? run coverage only for one system?

installer-uvx:
needs: build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- uses: actions/download-artifact@v4
with: { name: dist, path: dist }

- uses: astral-sh/setup-uv@v7

- name: uvx smoke
run: |
# Validate the CLI runs when installed via uvx directly from the wheel.
uvx --from "${{ needs.build.outputs.wheel }}" score-tools --help

installer-pipx:
needs: build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- uses: actions/download-artifact@v4
with: { name: dist, path: dist }

- name: pipx smoke
run: |
# Validate the CLI runs via pipx using an ephemeral environment from the built wheel.
# This avoids publishing requirements and extra PATH handling.
python -m pip install -U pip pipx
python -m pipx run --spec "${{ needs.build.outputs.wheel }}" score-tools --help

installer-pip:
needs: build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- uses: actions/download-artifact@v4
with: { name: dist, path: dist }

- name: pip smoke
run: |
# Validate the CLI installs and runs via pip.
# On Windows, invoking the console script can be finicky; calling module main is robust.
python -m pip install -U pip
python -m pip install "${{ needs.build.outputs.wheel }}"
python -c "import score_tools.cli as c; import sys; sys.exit(c.main([]))"

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ruff check src/ tests/
- run: ruff format --check src/ tests/
- run: mypy src
51 changes: 51 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Virtual environments
.venv/
venv/
ENV/
env/

# Pytest
.pytest_cache/

# Coverage
.coverage
.coverage.*
htmlcov/
coverage.xml

# Ruff cache
.ruff_cache/

# IDEs
.idea/

# Mac/Linux
.DS_Store
*.swp
*.swo
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
}
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- Initial release of score-tools
- Support for Python 3.12 and 3.13
- Ruff wrapper with Eclipse S-CORE defaults
- Automatic config discovery (ruff.toml, .ruff.toml, pyproject.toml)
- Bundled Eclipse S-CORE Ruff defaults
- Installable via pip/pipx/uvx with extras: `[ruff]`, `[all]`
- CLI flags: `--score-config`, `--print-config`, `--help`, `--version`
- Type hints (PEP 561 py.typed marker)
- Comprehensive test suite with pytest
- CI/CD with GitHub Actions (multi-OS, multi-Python version)
- Pre-commit hooks configuration
- Apache-2.0 license
- Documentation (README, CONTRIBUTING, CODE_OF_CONDUCT)

[Unreleased]: https://github.com/eclipse-score/tools/compare/...HEAD
5 changes: 5 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Code of Conduct

This project adheres to the [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).

By participating, you are expected to uphold this code. Please report unacceptable behavior to the maintainers.
38 changes: 38 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Contributing to score-tools

Thanks for your interest in contributing! This project is part of [Eclipse S-CORE](https://projects.eclipse.org/projects/automotive.score) and aims to provide thin wrappers around common developer tools with S-CORE defaults.

## Getting started

- Python 3.12 or 3.13
- Create a virtual environment and install dev deps:

```bash
python -m venv .venv && . .venv/bin/activate
pip install -e '.[dev,ruff]'
```

## Running tests

```bash
pytest -q
```

## Making changes

- Keep wrappers thin and predictable.
- Prefer conservative defaults. Project configs should always take precedence when present.
- Avoid hard dependencies in the base package; use extras like `[ruff]` and `[all]`.

## Releasing

- Bump `__version__` in `src/score_tools/__init__.py` and `pyproject.toml` as appropriate.
- Build and publish via your preferred workflow (e.g., `hatch build` or `python -m build` followed by `twine upload`).

## Code of Conduct

This project follows the Contributor Covenant. See `CODE_OF_CONDUCT.md`.

## License

By contributing to this project, you agree that your contributions will be licensed under the Apache License 2.0.
Loading
Loading