1- .PHONY : install lint format typecheck test coverage build clean check
1+ .PHONY : install hooks lint format typecheck test coverage build verify-lock dist- check samples check check-all clean
22
33install :
44 uv sync --all-extras
55
6+ hooks :
7+ git config core.hooksPath .githooks
8+ @echo " pre-push hook installed. Bypass a single push with 'git push --no-verify'."
9+
10+ # Asserts uv.lock is still consistent with pyproject.toml, which is what CI installs from.
11+ verify-lock :
12+ @printf ' \n\033[1m==> verify-lock\033[0m\n'
13+ uv sync --all-extras --locked
14+
615lint :
16+ @printf ' \n\033[1m==> lint\033[0m\n'
717 uv run ruff check .
818 uv run ruff format --check .
919
@@ -12,19 +22,49 @@ format:
1222 uv run ruff format .
1323
1424typecheck :
25+ @printf ' \n\033[1m==> typecheck\033[0m\n'
1526 uv run mypy
1627
1728test :
29+ @printf ' \n\033[1m==> test\033[0m\n'
1830 uv run pytest
1931
2032coverage :
33+ @printf ' \n\033[1m==> coverage\033[0m\n'
2134 uv run pytest --cov --cov-report=term-missing
2235
2336build :
37+ @printf ' \n\033[1m==> build\033[0m\n'
38+ rm -rf dist
2439 uv build
2540
41+ # Validates the built distribution's metadata and that the wheel imports on its own, in a
42+ # throwaway environment. Leaves dist/ in place so CI can upload it.
43+ dist-check : build
44+ @printf ' \n\033[1m==> dist-check\033[0m\n'
45+ uvx twine check dist/*
46+ @tmp=$$(mktemp -d ) ; \
47+ uv venv " $$ tmp/venv" --quiet \
48+ && VIRTUAL_ENV=" $$ tmp/venv" uv pip install --quiet dist/* .whl \
49+ && VIRTUAL_ENV=" $$ tmp/venv" uv run --no-project python -c \
50+ " import configdirector; print('wheel imports cleanly:', configdirector.__version__)" ; \
51+ status=$$? ; rm -rf " $$ tmp" ; exit $$ status
52+
53+ # Samples resolve the SDK by local path, so this is what catches a breaking API change.
54+ samples :
55+ @for sample in samples/* /; do \
56+ [ -f " $$ sample/pyproject.toml" ] || continue ; \
57+ printf ' \n\033[1m==> sample %s\033[0m\n' " $$ (basename $$ sample)" ; \
58+ (cd " $$ sample" && uv sync --quiet && uv run mypy && uv run pytest) || exit 1; \
59+ done
60+
61+ # The fast loop while working.
2662check : lint typecheck test
2763
64+ # Everything CI runs. The pre-push hook calls this.
65+ check-all : verify-lock lint typecheck test dist-check samples
66+ @printf ' \n\033[1m✓ all checks passed\033[0m\n'
67+
2868clean :
2969 rm -rf dist build .pytest_cache .mypy_cache .ruff_cache .coverage htmlcov
3070 find . -type d -name __pycache__ -prune -exec rm -rf {} +
0 commit comments