| 1 |
set shell := ["bash", "-euc"] |
| 2 |
|
| 3 |
python_oldest := "3.10" # Oldest supported version |
| 4 |
python_latest := "3.14" # Newest supported version |
| 5 |
python := "3.14" # Default version for dev loop |
| 6 |
python_versions := "3.10 3.11 3.12 3.13 3.14" |
| 7 |
|
| 8 |
taplo := "uvx [email protected]" |
| 9 |
|
| 10 |
@_default: |
| 11 |
just --list --unsorted |
| 12 |
|
| 13 |
fmt: |
| 14 |
uv run --only-group ruff ruff format . |
| 15 |
uv run --only-group ruff ruff check --fix --show-fixes . |
| 16 |
{{ taplo }} format |
| 17 |
just --fmt |
| 18 |
|
| 19 |
# Dev loop |
| 20 |
dev: fmt lint test |
| 21 |
|
| 22 |
# Full check |
| 23 |
check: lock-check lint lint-toml lint-yaml public-typing typing test-all |
| 24 |
|
| 25 |
# Install locked dependencies |
| 26 |
[group('project')] |
| 27 |
init: |
| 28 |
uv sync |
| 29 |
|
| 30 |
[group('project')] |
| 31 |
dist: |
| 32 |
uv build |
| 33 |
|
| 34 |
[group('project')] |
| 35 |
publish: |
| 36 |
uv publish |
| 37 |
|
| 38 |
[group('project')] |
| 39 |
clean: |
| 40 |
rm -rf dist .mypy_cache .pytest_cache .ruff_cache .uv-cache |
| 41 |
|
| 42 |
[group('test')] |
| 43 |
test version=python *args: |
| 44 |
uv run --python {{ version }} --no-default-groups --group tests pytest {{ args }} |
| 45 |
|
| 46 |
# Test all supported Python versions |
| 47 |
[group('test')] |
| 48 |
test-all: |
| 49 |
for v in {{ python_versions }}; do just test "$v"; done |
| 50 |
|
| 51 |
[group('test')] |
| 52 |
coverage version=python: |
| 53 |
uv run --python {{ version }} --no-default-groups --group tests \ |
| 54 |
pytest --cov=. --cov-branch --cov-report=term-missing:skip-covered |
| 55 |
|
| 56 |
# Type check our code |
| 57 |
[group('typing')] |
| 58 |
typing version=python_oldest: |
| 59 |
# --python-version is a mypy target flag, not a host interpreter |
| 60 |
uv run --no-default-groups --group mypy mypy --python-version {{ version }} . |
| 61 |
|
| 62 |
# Type check as if we're a consumer of the library |
| 63 |
[group('typing')] |
| 64 |
public-typing version=python_oldest: |
| 65 |
uv run --no-default-groups --group mypy mypy --python-version {{ version }} typing_checks |
| 66 |
|
| 67 |
[group('typing')] |
| 68 |
public-typing-all: |
| 69 |
for v in {{ python_oldest }} {{ python_latest }}; do just public-typing "$v"; done |
| 70 |
|
| 71 |
[group('lint')] |
| 72 |
lint: |
| 73 |
uv run --only-group ruff ruff format --diff . |
| 74 |
uv run --only-group ruff ruff check . |
| 75 |
|
| 76 |
[group('lint')] |
| 77 |
lint-toml: |
| 78 |
{{ taplo }} lint |
| 79 |
{{ taplo }} format --check --diff |
| 80 |
|
| 81 |
[group('lint')] |
| 82 |
lint-yaml: |
| 83 |
uv run --only-group yamllint yamllint --strict . |
| 84 |
|
| 85 |
[group('lint')] |
| 86 |
lock-check: |
| 87 |
uv lock --check |