Every Python repository validates through one script, bash scripts/check.sh [lint|test], and runs it in CI through the reusable workflows of github-workflows. This repository publishes no callable workflow of its own: it ships the script and the caller workflow through the Copier template.
- The check script
- The managed ci.yml
- Reusable workflows
- Path routing
- Repo-specific needs
- Required status checks
| Command | Runs |
|---|---|
bash scripts/check.sh |
uv sync --frozen, pre-commit on all files, pytest |
bash scripts/check.sh lint |
uv sync --frozen, pre-commit on all files |
bash scripts/check.sh test |
uv sync --frozen, pytest |
Any other argument exits with status 2. Ruff and mypy are local pre-commit hooks run with python -m inside the uv environment, so their versions come from uv.lock alone. Pytest runs with python -P, and its coverage options live in [tool.pytest.ini_options] addopts of pyproject.toml.
Copier renders .github/workflows/ci.yml and updates it on every copier update:
| Job | Calls | Runs when |
|---|---|---|
route |
pr-route.yml |
always |
lint |
python-check.yml, target lint |
always |
pytest |
python-check.yml, target test |
the route is applicable |
coverage |
coverage.yml |
the route is applicable |
tests-success (Tests success) |
gate over route, pytest, coverage |
always |
The uses: pins live in the template, so adopters receive new github-workflows versions through copier update. Do not bump them by hand.
The inputs are documented in each callee; the ones adopters meet most:
| Workflow | Inputs |
|---|---|
python-check.yml |
target (required, lint or test), python-version, runs-on, pre-install-command, env (KEY=VALUE lines), uv-sync-args, coverage-artifact (coverage-*), timeout-minutes |
pr-route.yml |
rules-file, runs-on, timeout-minutes; output applicable |
coverage.yml |
line, branch, patch (thresholds can only be raised), report-artifacts, base-ref |
python-check.yml runs uv sync --locked followed by bash scripts/check.sh <target>.
pr-route.yml reads .github/pr-route.json from the pull request base commit, with exactly the string arrays skip_files, skip_prefixes, skip_suffixes and build_inputs. applicable is false only when every changed path is listed as skippable; without the file, or with an invalid one, everything runs. The file belongs to the consumer repository.
- Settings of the standard jobs: pass
env,pre-install-command,runs-onortimeout-minutesinci.yml. Copier merges local edits with upstream changes, like a git merge. Extras foruv syncgo through theuv_sync_argsCopier answer. - Service containers:
python-check.ymlhas noservices:input. Start databases from the tests with testcontainers. - Extra jobs (migrations, OpenAPI, performance): add them to
ci.ymlwith the sameneedsandifaspytest, and list them in theneedsoftests-success, which only aggregates the jobs it names.
Require lint / check and Tests success. route / route, pytest / check and coverage / coverage are covered by the gate: declare them as optional jobs (route/route, pytest/check, coverage/coverage) in the organization's required-checks.json in github-config.