Skip to content

Develop and validate changes

Use the repository's Hatch environments to check a change before submitting it. Run the commands below from the checkout root. You will need Git, Hatch and the CPython interpreters for the checks you intend to run. The full test matrix uses 3.11–3.15.

Read the contribution policy before preparing a patch. It covers authorship, licensing, submission and changes to public contracts.

Prepare the checkout

Clone your fork, or clone the project to inspect and test it locally:

Clone the repository
git clone https://github.com/AxelVoitier/lookups.git
cd lookups
hatch env show

Hatch creates the selected environment and installs its dependencies when you first run a check. Use the environments defined in pyproject.toml rather than setting up separate copies of the development tools.

Install the Python versions selected by the Hatch environments before running the corresponding checks. The test matrix uses CPython 3.11–3.15, combined QA uses Python 3.15, and the documentation environment uses Python 3.13. If Hatch cannot discover an installed interpreter, add its executable directory to PATH.

Check the contract and select tests

Before changing behaviour, read the relevant sections of the public contract inventory, to understand the intended behaviour. Use the test map to find the tests for the affected interface and understand what they leave unasserted. An implementation detail or an existing test does not, by itself, establish a compatibility promise.

Add or update tests for changed behaviour, and update the affected contract documentation and test-map entries. Preserve type information in public query signatures. If the documentation and implementation disagree, raise the specific conflict with the maintainer rather than choosing a new contract silently. Follow the contribution policy when proposing a change to a stable public API.

Run the relevant file while working. For example, for generic lookup changes:

Run focused tests
hatch run tests.py3.15:pytest tests/test_generic_lookup.py

Format, lint and check types

Run Ruff formatting, then check formatting and lint:

Format and lint
hatch run lint:format
hatch run lint:check-format
hatch run lint:check

Ruff formatting rewrites files, while the formatting and lint checks leave them unchanged. Ruff covers lookups/ and tests/, including experimental APIs. The configuration sets a line length of 100 and maximum complexity of 15. Keep existing lint exceptions local to the cases that need them: the two listener scenario helpers' PLR0917 exceptions are not a general exemption. Ruff formatting owns trailing commas, so the conflicting COM812 lint rule is disabled.

Run both strict type checkers after code changes:

Check types
hatch run typing:check

Pyright is the primary checker, and mypy provides an additional check. Prefer clear code over workarounds for diagnostics reported only by mypy. To investigate one checker separately, use:

Run an individual checker
hatch run typing:check-pyright
hatch run typing:check-mypy

Both check the library and tests, including experimental APIs. Pyright reports existing import cycles as information. Mypy disables type-abstract for lookups.lookup because abstract classes are valid searched types: these queries select objects rather than instantiate the searched class.

Run the checks before submitting

Run the combined QA command and the complete test matrix:

Run QA and the test matrix
hatch run qa:run
hatch run tests:run

QA checks formatting and lint, runs both type checkers and runs the full suite on Python 3.15. It continues through check failures so you can see all reported failures. Inspect the results and resolve failures before submitting. QA does not replace tests:run, which runs the configured CPython 3.11–3.15 matrix. The test run scripts collect coverage and write cov.xml.

If the change affects documentation or API docstrings, run the strict site build:

Check documentation
hatch run doc:check

Follow Write, build and publish documentation for executable examples, typed examples and rendered checks. A successful local build validates the documentation. Publication has its own workflow.

Use Hatch for these checks. The legacy Makefile still names Flake8 and obsolete build commands. The Hatch configuration defines the development commands.