Skip to content

About

Organization-wide baseline standards for Python repos: pinned tooling, pre-commit, CI, and contributor workflows.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

python-project-standards

Organization-wide baseline standards for Python repositories: pinned tooling, pre-commit, CI, and contributor workflows.

Table of Contents

Purpose

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.

Development documentation

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.

What Is Standardized

  • Shared policy and doc index in docs/development.md (includes links to style pages under docs/);
  • pyproject.toml tooling sections (ruff via baselines/ruff.toml + thin overlay, strict mypy keys, pytest with branch coverage through pytest-cov);
  • .pre-commit-config.yaml: ruff and mypy run from uv.lock as 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.

Repository Layout

  • copier.yml + template/: Copier template rendered into consumer repos — .pre-commit-config.yaml, baselines/ruff.toml, scripts/check.sh, .github/workflows/ci.yml (updated by copier update), plus a bootstrap-only pyproject.toml; copier copy (with --trust) also creates missing src/<package>/ and tests/ 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 between STANDARDS_VERSION and every pin carrying the Release Please version marker (see docs/versioning.md).

Usage Model

  1. Render the template into a new or existing repository with copier copy.
  2. Add explicit, documented project-level overrides.
  3. Pull new releases with copier update; the adopted release is recorded in .copier-answers.yml.

Design Principles

  • 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.

Quick Start (Consumer Repo)

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 validate

For 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.

Adoption tiers

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 contract

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.

Releases

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.

Status

Baseline is versioned; evolve via tagged releases and migration notes, not only through main.

About

Organization-wide baseline standards for Python repos: pinned tooling, pre-commit, CI, and contributor workflows.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages