Organization-wide baseline standards for Python repositories: pinned tooling, pre-commit, CI, and contributor workflows.
- Purpose
- Development documentation
- What Is Standardized
- Repository Layout
- Usage Model
- Design Principles
- Quick Start (Consumer Repo)
- Adoption tiers
- CI contract
- Releases
- Status
This repository provides a shared baseline for Python projects so teams can:
- keep lint, format, and type checks consistent across repositories;
- reduce CI/local drift;
- document process expectations in one place;
- allow project-specific ignores (Ruff per-file, Mypy overrides) without forking the shared rule baseline.
docs/development.md is the hub for organization-wide Python development policy (links to migration, versioning, CI reusables, and style notes such as string enums). Point consumer DEVELOPMENT.md / contributor docs at that page for shared baselines.
Portable agent guidance is an optional Copier bootstrap; see development guidance.
- Shared policy and doc index in docs/development.md (includes links to style pages under
docs/); pyproject.tomltooling sections (ruffviabaselines/ruff.toml+ thin overlay, strictmypykeys,pytestwith branch coverage throughpytest-cov);.pre-commit-config.yaml: ruff and mypy run fromuv.lockas local hooks, other hooks pin their revisions;scripts/check.sh [lint|test], the single validation entry point, locally and in CI;.github/workflows/ci.yml, calling the reusable workflows of github-workflows;- migration and versioning guidance.
copier.yml+template/: Copier template rendered into consumer repos —.pre-commit-config.yaml,baselines/ruff.toml,scripts/check.sh,.github/workflows/ci.yml(updated bycopier update), plus a bootstrap-onlypyproject.toml;copier copy(with--trust) also creates missingsrc/<package>/andtests/starters.docs/: development.md (hub), migration guide, versioning, CI contract, and style notes (e.g.string-enums.md).scripts/tests/: repository checks, including the read-only sync betweenSTANDARDS_VERSIONand every pin carrying the Release Please version marker (see docs/versioning.md).
- Render the template into a new or existing repository with
copier copy. - Add explicit, documented project-level overrides.
- Pull new releases with
copier update; the adopted release is recorded in.copier-answers.yml.
- Tooling config is the primary enforcement mechanism.
- Exact version pinning for reproducibility.
- Baseline plus local overrides.
- Minimize duplicated policy text between tools, CI, and AI rules.
uv tool install copier==9.18.2
copier copy --trust gh:BehindTheMusicTree/python-project-standards /path/to/repo # new repo
copier update # later, from the repo root
uv lock && bash scripts/check.sh # new repo: lock once, then validateFor an existing repository, see docs/migration-guide.md. Keep [tool.ruff] extend = "baselines/ruff.toml" in pyproject.toml; shared rule changes arrive through copier update.
All tiers share the CI contract; they differ in what they add to the managed ci.yml.
| Tier | Typical repo | Added locally |
|---|---|---|
| A — Library | Packaged library | Usually nothing |
| B — Service / API | Django/FastAPI apps, database, long integration jobs | Environment, testcontainers, extra jobs (migrations, OpenAPI), deploy workflows |
CI runs bash scripts/check.sh lint and bash scripts/check.sh test through python-check.yml, routes pull requests with pr-route.yml, checks coverage with coverage.yml and aggregates the result in the Tests success gate. See docs/reusable-workflows.md.
Versions are SemVer (v1.2.3 tags, STANDARDS_VERSION without v). Release Please opens a release PR from conventional PR titles; merging it updates STANDARDS_VERSION, the marked pins and CHANGELOG.md, then CI creates vX.Y.Z and publishes the GitHub Release. Consumers adopt a release with copier update. See docs/versioning.md.
Baseline is versioned; evolve via tagged releases and migration notes, not only through main.