Python Engineering Standard

v1.0 · Latest

A standard for Python repositories that use uv, Ruff, a type checker, and pytest. Covers runtime compatibility, dependency audits, and checks for the package users install.

Agent access · Pure Markdown (no HTML)

Coding agents can fetch /standards/python.md directly (or pinned https://fitchhub.com/standards/python/v1.0.md), or request this page URL with Accept: text/markdown to receive pure Markdown without HTML.

Version 1.0 · 2 December 2026

  • Canonical agent-readable Markdown (always the latest version): https://fitchhub.com/standards/python.md
  • Pinned release Markdown (this version only): https://fitchhub.com/standards/python/v1.0.md

This standard governs Python code, packaging, linting, type checking, and verification. It applies to agents adopting the checks and to engineers reviewing their work.

Check the code that runs. A clean type check cannot establish that FastAPI can register a route or that a wheel contains the module a consumer imports. Test those boundaries with the actual framework or installed artifact.

Keep stronger checks that protect a contract. Repair the code that owns the finding. If the best compliant change would break a supported behavior, show the user driving the work before changing enforcement.

Keep the quality interpreter separate from the runtime promise. .python-version selects the interpreter for the quality job. project.requires-python tells installers which Python versions can run the distribution.

  1. Core principles and tool floors
  2. Adoption and existing repositories
  3. Code and design discipline
  4. Linting, formatting, and type checking
  5. Dependencies, lockfiles, and runtime compatibility
  6. Verification profiles
  7. Verification gate

1. Core principles and tool floors

Link to 1. Core principles and tool floors

Use the baseline with the profiles that describe what you ship. Must identifies a requirement. Should identifies a recommendation. May identifies a permitted choice. A check for a public wheel does not apply to a notebook that ships no wheel.

1.1 Verified minimum versions

Link to 1.1 Verified minimum versions

These are quality-tool floors verified on 2 December 2026. They are neither pins nor ceilings. Install current compatible releases. Commit the selected project dependencies in uv.lock so developers and CI run the same tools. An optional tool's floor applies only when you use it.

ToolMinimumRole
CPython3.15.2Interpreter for the quality job. Test an older supported runtime separately.
uv and uv_build0.13.12Resolve, lock, synchronize, and build. The bundled backend builds pure-Python packages.
Ruff0.17.6Lint and format Python source, stubs, and notebooks.
ty1.0.0Primary type checker for new projects. Stable since 1 December 2026.
basedpyright1.40.2Alternative for repositories with established strict typing or public type-completeness checks.
pytest9.2.0Run behavioral tests with native TOML configuration.
pytest-asyncio1.5.0Run asyncio tests. Omit it from synchronous suites.
deptry0.25.1Compare production imports with declared dependencies.
pip-audit2.10.1Check locked dependencies against published advisories.
Hatchling1.33.0Alternative pure-Python backend when a package needs build hooks.

Use installed tools to investigate a diagnostic. uv run --locked ruff rule B023 explains a loop-variable finding. uv run --locked ruff check --show-settings path/to/module.py shows the effective file policy. Inspect the installed dependency and its versioned documentation before adding a wrapper or suppression.

1.2 What the baseline covers

Link to 1.2 What the baseline covers

The v1.0 calibration covered 88,242 lines in 303 files across five repositories. They included FastAPI, Pydantic v2, SQLAlchemy 2, Alembic, Typer, Textual, Pandas, Streamlit, httpx, and asyncio. Section 4 distinguishes checks that found bugs from changes that broke a working framework contract. Use the checks as a starting point. Run your own integrations before accepting a fix.

2. Adoption and existing repositories

Link to 2. Adoption and existing repositories

2.1 Start with the repository's contract

Link to 2.1 Start with the repository's contract
  1. Record the revision and run the existing acceptance command. Keep unrelated changes intact.
  2. Read pyproject.toml, lockfiles, interpreter selection, checker configuration, test configuration, CI jobs, and release commands. Check for nested projects with their own settings.
  3. List the code that runs: import packages, command entry points, migrations, scripts, and notebooks. Identify which Python versions, platforms, extras, and deployment environments the project supports.
  4. Apply the settings to the existing files. Map the example package name and test paths in Appendix A to the real layout. Run pytest --collect-only in the locked environment when you change test discovery. Compare the collected tests with the original suite.
  5. Run the baseline and the applicable profiles. Check the affected user behavior before reporting success.

For an upgrade, compare the effective old and new configurations. Keep local settings with a demonstrated benefit. Do not replace a working basedpyright gate with ty solely to match a starter file. Record which code changes checker, and compare diagnostics before retiring the old check.

2.2 Resolve findings without hiding them

Link to 2.2 Resolve findings without hiding them

Group related findings by the code that owns the behavior. If several callers see an untyped payload, fix the parser they share. Do not add a cast in every caller. For a framework callback, read the framework's signature before removing an argument or changing a default.

If the straightforward fix breaks compatibility or adds complexity without a meaningful correctness benefit, reproduce the conflict. Give the driving user the command, diagnostic, tool version, affected contract, and best compliant alternative. Show what a narrower exception would preserve. A large diagnostic count alone does not justify an exception.

Put a necessary suppression on the affected line. Name the rule and explain the contract in the same comment. Use # noqa: B008 with a specific reason for Ruff, or # ty: ignore[invalid-assignment] -- reason for ty. Replace reason with the fact the checker cannot express. For basedpyright, use # pyright: ignore[reportAssignmentType] with the same evidence. Reject bare # noqa, # ty: ignore, and # type: ignore. Remove a suppression when the checker no longer needs it.

3. Code and design discipline

Link to 3. Code and design discipline

3.1 Types and validation

Link to 3.1 Types and validation

Parse external data where it enters the application. Return the validated value to callers. For example, a Pydantic field may accept a numeric string and produce an int. Preserve both the accepted wire format and the type of the resulting attribute. A TypedDict documents keys for a checker. It does not check an incoming dictionary at runtime.

Use object when you must inspect an unknown value before using it. Use Any when a genuinely dynamic boundary requires it, then narrow the value before using it as a domain type. Give decorators that preserve a callable's signature a ParamSpec when the signature is known. Do not invent a protocol with methods that the input need not implement.

Annotate production parameters and return types. Keep mutable instance state on the instance. Use a default factory for a dataclass field that owns a list. Mark a mutable class value as ClassVar only when the contract actually shares it across instances.

3.2 Errors, resources, and async work

Link to 3.2 Errors, resources, and async work

Catch the exception you can handle. When translating an error, use raise DomainError(...) from err so callers can inspect its cause. Keep validation and recovery distinct. A database connection failure does not mean a query returned no rows.

Use a context manager for files, clients, and transactions. Keep the commit and rollback boundaries intact when extracting a helper. Bind SQL values through the database API. Use aware datetimes for instants, such as datetime.now(UTC) on runtimes that provide UTC. A local calendar date does not need a fabricated time zone.

Keep blocking I/O off the event loop. Use an async client or move a blocking call to an appropriate worker. Give each task an owner that observes its result. Use asyncio.TaskGroup when sibling tasks should share a lifetime. For a longer-lived task, retain a strong reference and handle its outcome at shutdown. Use finally for cleanup and let cancellation propagate.

3.3 Banned compliance shims

Link to 3.3 Banned compliance shims
FindingPreserve the behaviorReject this change
A checker cannot infer a JSON field.Validate the field once. Test a malformed payload.cast(int, raw) presented as validation, or Any added only to hide the error.
A dependency annotation appears unused.Keep the name available when FastAPI inspects the signature.Moving the only runtime import under TYPE_CHECKING, or deleting a parameter read by the framework.
A callback reports too many arguments.Keep the supported call signature. Extract a separate operation only if it has its own contract.A parameter bag that changes CLI flags, injection, or generated schemas.
A coroutine reports an unhandled failure.Await the work or return its task to an owner.Starting a detached task or swallowing an exception to make the check pass.
A warning exposes an obsolete API or test setup.Update the call or fix the fixture lifetime.Ignoring all warnings, skipping a failing test, or replacing the real consumer with a mock that returns the expected answer.

4. Linting, formatting, and type checking

Link to 4. Linting, formatting, and type checking

4.1 Ruff baseline

Link to 4.1 Ruff baseline

Use both ruff check . and ruff format --check . in the locked environment. A formatter pass does not check imports, closures, or unsafe calls. Use the stable rules in Appendix A. Review automatic fixes in context. Do not enable unsafe fixes for the whole repository.

SelectionFindings to act on
F, E, W, I, UP, ISC001Find undefined names, invalid comparisons, and misplaced imports. Keep modern syntax compatible with requires-python. ISC001 detects adjacent string literals on one line and works with the formatter in Ruff 0.17.6.
B, BLE, RSECheck mutable argument defaults (B006), loop variables captured by closures (B023), lost exception causes (B904), broad exception handlers, and unnecessary raise syntax.
ASYNC, RUF, DTZCheck blocking calls in async functions, unowned tasks (RUF006), mutable class defaults (RUF012), and naive timestamps such as datetime.now() or datetime.utcnow().
SCheck missing requests timeouts and explicit httpx timeout disabling (S113), interpolated SQL (S608), unsafe YAML loads (S506), and subprocess calls with shell=True (S602).
T20, LOG, G, PTCatch stray prints, root logger calls (LOG015), eager log f-strings (G004), and mistakes in pytest assertions and fixtures. Use a module logger and pass values as log arguments.
SIM, PERF, FURB, PIE, RET, TID, C400, C401, C402Check redundant branches, unnecessary copies and comprehensions, return paths, and import conventions. Preserve lazy evaluation when callers depend on it.
PLE, PLW0120, PLW1508, PLW1510Catch invalid operations, loop else without break, invalid defaults for environment variables, and subprocess calls without an explicit check policy.
PGH, RUF100, RUF101, RUF102Reject blanket ignore comments and unused, redirected, or invalid Ruff suppression codes. The RUF selection includes all three RUF checks.
ANN001, ANN002, ANN003, ANN201, ANN202, ANN204, ANN205, ANN206Require annotations on ordinary parameters, variadic arguments, and returns, including methods. Do not enable ANN401 in the baseline.

Keep the annotation checks with ty. In calibration, ty 1.0.0 accepted def untyped(v): return v.missing() because the parameter had no known type. The Ruff annotation checks reject the missing contract. Declare the real parameter type so ty can check the member access. A dynamic decorator can accept **kwargs: Any when the wrapped call has no known signature. A JSON adapter can expose dict[str, Any] before validation. Do not replace these annotations with fictional types.

Map exceptions to their actual files. In tests/**, allow assert (S101) and omit ANN requirements for fixtures and tests. Keep the other checks in tests. Exempt intentional console output (T20) in CLI entry points, scripts, and notebooks. Do not exempt the package that implements the CLI's business logic.

4.2 Checks outside the baseline

Link to 4.2 Checks outside the baseline
Omit or ignoreReason
TCUnder from __future__ import annotations, moving imports under if TYPE_CHECKING: broke FastAPI dependency and request-body resolution. Fourteen test modules failed at import with FastAPIError or PydanticUndefinedAnnotation. runtime-evaluated-base-classes does not cover plain route parameter annotations. Consider TC001 through TC003 only in a pure library where no framework reads the annotations at runtime.
D, PLR2004A docstring on every item or a name for every numeric literal does not explain an API contract. Document units, errors, and public behavior where callers need them.
TRY003, EM101, EM102Extracting exception messages solely for a check adds code without improving the error contract.
FBT, PLR0913, C901Typer boolean options are public flags. FastAPI Depends() adds parameters to a route signature. Neither fact determines whether a function should be split. Review the actual decisions.
ERA001, INP001The commented-code check flagged 93 SQL or HTTP comments in calibration. Standalone scripts and Alembic revisions need not belong to import packages.
E111, E114, E117, W191, E501Let the formatter own indentation. Do not rewrite a URL or break an SQL literal to meet a line-length diagnostic.
S311, S603, S607Ordinary backoff jitter need not use a cryptographic generator. Fixed argv such as subprocess.run(["git", "--version"], check=True) does not need a shell or a hardcoded /usr/bin/git. Keep S602. Choose a trusted executable when the search path is a security boundary. Use secrets for tokens.

4.3 Primary checker: ty

Link to 4.3 Primary checker: ty

Use ty check --error-on-warning. Version 1.0.0 already fails on warnings by default. The flag makes CI policy explicit. Add --output-format concise for one diagnostic per line. On a 70,500-line FastAPI, Pydantic, and SQLAlchemy codebase, one cold check took 0.31 seconds. This measurement is not a time budget for other repositories.

Use ty's built-in Pydantic v2 support. In lax mode, ty accepts a string for an integer field and infers int for the attribute. A string with non-numeric contents can still fail runtime validation. Test the actual input conversion.

Set respect-type-ignore-comments = false under [tool.ty.analysis]. Under [tool.ty.rules], reject blanket and unused checker comments, omitted generic arguments, disjoint casts, and unsound returns and yields. See Appendix A for the exact keys. Do not enable unsound-assignment = "error" on SQLAlchemy 2 projects. mapped_column(...) returns MappedColumn[Any]. The rule reports valid declarations such as id: Mapped[int] = mapped_column(primary_key=True). Do not cast the column to int or change the mapped attribute's type to silence it.

4.4 Alternative checker: basedpyright

Link to 4.4 Alternative checker: basedpyright

Keep basedpyright when a repository relies on its stricter Unknown or Any checks, or checks a py.typed package with --verifytypes. Add basedpyright>=1.40.2 to the development group. For an alternative rather than a second checker, replace the ty dependency, settings, and gate command together. Run uv run --locked basedpyright --warnings.

Choose a mode explicitly. The 1.40.2 default is "recommended", not "standard". It enables reportAny and the reportUnknown* rules. In calibration, that policy produced 3,840 findings on JSON and ORM code. Start a strict library with typeCheckingMode = "strict". Keep any additional Any checks that already protect its API. For an application with dynamic data or ORM types, use "standard" with explicit error rules. For example:

[tool.basedpyright]
typeCheckingMode = "standard"
enableTypeIgnoreComments = false
reportMissingParameterType = "error"
reportMissingTypeArgument = "error"
reportUnnecessaryTypeIgnoreComment = "error"
reportIgnoreCommentWithoutRule = "error"

Keep the two ignore-comment checks and enableTypeIgnoreComments = false in either mode. A checker exception that no longer suppresses a finding must fail CI.

5. Dependencies, lockfiles, and runtime compatibility

Link to 5. Dependencies, lockfiles, and runtime compatibility

5.1 Declare dependencies where users need them

Link to 5.1 Declare dependencies where users need them
UseDeclaration
The installed package imports the dependency to perform its normal work.Add it to project.dependencies, even if another dependency installs it today.
A consumer requests an optional capability.Put the dependency under project.optional-dependencies. Test the extra and the supported base install without it.
Only developers or CI run the dependency.Use PEP 735 [dependency-groups]. Do not publish linters as runtime requirements.
The backend needs the dependency to build a distribution.Declare it in build-system.requires. An installed development group does not supply an isolated build.

Use uv lock when changing requirements. Review and commit uv.lock. Use uv lock --check and uv sync --locked for acceptance. Do not refresh a stale lockfile as a side effect of verification. For a workspace, declare dependencies in the member that imports them. Run the checks against each member's manifest and test the members that ship together.

Use uv run --locked deptry . in each project. Fix missing declarations (DEP001), unused runtime declarations (DEP002), imports of transitive dependencies (DEP003), and production imports of development dependencies (DEP004). Check entry points, framework plugins, and dynamic imports before deleting a dependency. If a distribution name differs from its import, configure its real mapping. Keep a necessary exception specific to the package and the rule.

5.2 Audit the lockfile you use

Link to 5.2 Audit the lockfile you use

pip-audit --locked . looks for pylock.toml or pylock.*.toml. It does not read uv.lock. Appendix A exports a temporary pylock.toml from the checked lockfile, including every dependency group and extra in the starter. --no-emit-workspace omits your own packages and retains their dependencies. --strict makes failed dependency collection a failure of the audit. Do not substitute an audit of the developer's current environment.

If the project declares mutually exclusive extras or groups, export and audit each supported combination rather than requesting them together. Record any private dependency the scanner cannot check and how you audit it. A failed lookup is not a clean result. An audit checks known advisories in the resolved packages. It does not test the repository's own code.

uv 0.13.12 also has an experimental native command: uv audit --locked --preview-features audit-command. Before adopting it instead of the export, compare its dependency coverage and advisory results for the repository's supported environments.

5.3 Select the interpreter and backend

Link to 5.3 Select the interpreter and backend

Commit .python-version for the local and CI quality interpreter. Retain the published requires-python range and test its lower bound. Ruff and ty can infer a target from requires-python. Do not set Ruff's target-version or ty's python-version to the quality interpreter if the package still supports an older Python. When quality tools require a newer Python than the library, give their dependency group its own requires-python under [tool.uv.dependency-groups]. Run the compatibility job with dependencies that work on that runtime.

Use uv_build for a pure-Python package without custom build hooks. In [build-system], uv_build>=0.13.12,<0.14 is the backend's documented compatibility range. The upper bound applies to the backend API, not the uv quality tool. For custom build hooks, use a suitable backend such as hatchling>=1.33.0. For a compiled extension, use the backend that builds the native code, such as maturin for Rust. Build and install a wheel on each supported native target where the ABI differs.

6. Verification profiles

Link to 6. Verification profiles

6.1 Public libraries

Link to 6.1 Public libraries

Ship a py.typed marker inside an inline-typed import package. Check the built wheel, not just src/. Build the source distribution and its wheel with uv build --no-sources. This disables uv's development source overrides for the build. Install the wheel outside the project's editable environment. Import its public API, call it, and verify the marker in the installed package. Appendix A runs this smoke test without exposing the checkout on Python's search path.

Run the library's tests on its minimum supported Python as well as the quality interpreter. For the starter's Python 3.12 floor, uv run --isolated --locked --python 3.12 pytest runs the suite in a separate environment. Substitute the real compatibility floor and supported extras. Where the library already checks exported type completeness, also run uv run --locked basedpyright --verifytypes billing_dates --ignoreexternal with the actual import name. This checks the library's public types without scoring external packages.

6.2 Applications and services

Link to 6.2 Applications and services

Test the environment you deploy. A source-deployed service does not need a public type marker or wheel. If the service ships as a wheel, test that wheel. Run startup with the locked runtime dependencies, without development groups. Exercise a real entry point: send a request through the registered FastAPI route, invoke the Typer command, or start the worker and observe the job result.

For FastAPI, test dependency injection, request parsing, validation errors, and response serialization where the change affects them. Keep types used in route signatures available to the framework. Verify a SQLAlchemy mapping through a real session. Apply changed Alembic revisions to a database using the supported dialect. A mock cannot establish that the migration runs or that the database retains the intended data.

Keep CLI output on the promised stream and check the exit status. In an async service, test cancellation or timeout where it changes observable state. Do not replace an async API with a synchronous call to satisfy a checker.

6.3 Standalone scripts and notebooks

Link to 6.3 Standalone scripts and notebooks

For a standalone script, put the supported Python and dependencies in a PEP 723 block in the script itself. For example, this block declares a script that needs only the standard library:

# /// script
# requires-python = ">=3.12"
# dependencies = []
# ///

Run uv lock --script report.py and commit report.py.lock beside report.py. In CI, run uv lock --check --script report.py and uv run --locked --script report.py with representative inputs. Run Ruff on the script. Type-check it with its declared dependencies available, rather than assuming the application environment supplies them. Do not add __init__.py or a wheel build solely for a standalone script.

Run Ruff on the notebook itself. A lint or format pass does not execute cells. For a notebook you ship, execute it from a fresh kernel in its declared environment with representative data. Verify the resulting table, figure, or file that the user consumes. Keep a notebook's display output distinct from stray prints in library code.

7. Verification gate

Link to 7. Verification gate

Run Appendix A's check script from the project root. Use the same command locally and in CI. For non-package profiles, retain the applicable checks and replace the artifact step with the actual entry-point test. Install the groups and extras that each job exercises. Do not let a later uv run drop a required extra: pass the same selection to the run. Run exclusive extras in separate jobs.

Use pytest 9's native [tool.pytest] table with TOML booleans and arrays. Never mix it with [tool.pytest.ini_options] in the same file. pytest 9.2.0 exits with status 4 before collection when both tables contain settings. strict = true enables strict_config, strict_markers, strict_parametrization_ids, and strict_xfail. Pair strict mode with filterwarnings = ["error"]. Register markers the suite actually uses. An expected failure that unexpectedly passes must fail the gate.

Only for asyncio tests, add pytest-asyncio>=1.5.0 to the development group. For an asyncio-only suite, add these keys to the existing [tool.pytest] table:

asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"

Use "fixture-scope" instead when each async fixture needs a loop that matches its fixture scope. With pytest-asyncio 1.5.0 and warnings treated as errors, leaving the loop scope unset turns a startup warning into exit 3. For suites that mix async frameworks, use asyncio_mode = "strict" and mark the asyncio tests and fixtures explicitly. Do not put plugin settings in a synchronous suite with no plugin installed.

A passing gate must propagate each check's exit status. Preserve the diagnostic and fix its cause. Record the command, interpreter, platform, and result for each supported combination you exercised. Distinguish source tests from a wheel install, project checks from standalone scripts, and test collection from test execution.

Appendix A: Starter files

Link to Appendix A: Starter files

This starter is a synchronous pure-Python library named billing-dates. Its import package is billing_dates. It supports Python 3.12 and later. Use the repository's real names and compatibility promise when adopting it.

A.1 .python-version

Link to A.1 .python-version
3.15.2

A.2 pyproject.toml

Link to A.2 pyproject.toml
[project]
name = "billing-dates"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = []

[build-system]
requires = ["uv_build>=0.13.12,<0.14"]
build-backend = "uv_build"

[dependency-groups]
dev = [
    "deptry>=0.25.1",
    "pip-audit>=2.10.1",
    "pytest>=9.2.0",
    "ruff>=0.17.6",
    "ty>=1.0.0",
]

[tool.uv]
required-version = ">=0.13.12"

[tool.ruff]
src = ["src"]

[tool.ruff.lint]
select = [
    "F", "E", "W", "B", "I", "UP", "SIM", "ASYNC", "S", "BLE", "DTZ",
    "T20", "PT", "RUF", "PERF", "FURB", "LOG", "G", "PIE", "RSE", "RET",
    "TID", "PGH", "ISC001", "PLE", "PLW0120", "PLW1508", "PLW1510",
    "C400", "C401", "C402", "ANN001", "ANN002", "ANN003", "ANN201",
    "ANN202", "ANN204", "ANN205", "ANN206",
]
ignore = ["E111", "E114", "E117", "W191", "E501", "S311", "S603", "S607"]

[tool.ruff.lint.per-file-ignores]
"tests/**" = ["S101", "ANN"]
"**/__main__.py" = ["T20"]
"scripts/**" = ["T20"]
"*.ipynb" = ["T20"]

[tool.ty.analysis]
respect-type-ignore-comments = false

[tool.ty.rules]
blanket-ignore-comment = "error"
unused-ignore-comment = "error"
missing-type-argument = "error"
disjoint-cast = "error"
unsound-return = "error"
unsound-yield = "error"

[tool.pytest]
testpaths = ["tests"]
strict = true
filterwarnings = ["error"]

A.3 Package and test

Link to A.3 Package and test

Save the public function in src/billing_dates/__init__.py. Create an empty src/billing_dates/py.typed alongside the module.

from datetime import date


def month_start(day: date) -> date:
    """Return the first calendar date of the given month."""
    return date(day.year, day.month, 1)

Save the test in tests/test_billing_dates.py:

from datetime import date

from billing_dates import month_start


def test_month_start_on_leap_day():
    assert month_start(date(2024, 2, 29)) == date(2024, 2, 1)

Run uv lock once to create uv.lock. Commit it with the starter files. Do not run an unlocked uv lock in the check script.

A.4 scripts/check.sh

Link to A.4 scripts/check.sh

Run sh scripts/check.sh from the project root. The final two commands check the library profile. The build writes to an empty directory so an older wheel cannot satisfy the smoke test.

#!/bin/sh
set -eu

uv lock --check
uv sync --locked
uv run --locked ruff check .
uv run --locked ruff format --check .
uv run --locked ty check --error-on-warning --output-format concise
uv run --locked deptry .
uv run --locked pytest

audit_dir=$(mktemp -d)
trap 'rm -rf "$audit_dir"' EXIT
uv export --locked --all-groups --all-extras --no-emit-workspace \
    --format pylock.toml --output-file "$audit_dir/pylock.toml" > /dev/null
uv run --locked pip-audit --strict --locked "$audit_dir"

uv build --no-sources --out-dir "$audit_dir/dist"
uv run --isolated --no-project --with "$audit_dir"/dist/*.whl python -I - <<'PY'
from datetime import date
from importlib.resources import files

from billing_dates import month_start

assert month_start(date(2024, 2, 29)) == date(2024, 2, 1)
assert files("billing_dates").joinpath("py.typed").is_file()
PY

Appendix B: Repository verification record

Link to Appendix B: Repository verification record

For this release, Appendix A ran on macOS arm64 with CPython 3.15.2 and the primary tool versions in Section 1.1. The check script exited with status 0. The wheel installed in isolation, its public function returned the expected date, and the installed package contained py.typed. The same source test passed separately on CPython 3.12.13.

Keep a short record in the adoption PR or the repository's existing engineering notes. Link the pinned standard. Point the repository's agent instructions to the canonical URL and its actual acceptance command.

RecordWhat a maintainer needs to reproduce the result
Revision and scopeCommit, package roots, standalone scripts, notebooks, and applicable profiles.
EnvironmentQuality interpreter and tool versions, supported runtime floor, operating systems, dependency groups, and extras.
Commands and resultsExact commands and exit statuses. Identify the tested entry point or installed wheel. Name any untested combination.
Local policyStronger checks worth keeping, reasons for a project-level difference, and the command that enforces it. Keep source-level reasons next to the affected line.

Appendix C: Changelog

Link to Appendix C: Changelog

v1.0 (2 December 2026)

Link to v1.0 (2 December 2026)

Initial standard. Defines the quality-tool floors, the Ruff and ty configuration, and the basedpyright alternative. Specifies locked dependency audits and separate verification for libraries, services, scripts, and notebooks.