codedoctor🩺
Pre-commit gates that run each heavy check once per commit, sized to the machine and below interactive priority.
Quickstart
cd /path/to/your/repo
uvx codedoctor install
uv add --group pre-commit rekursiv-ai-typings
uv run --group pre-commit pre-commit run --all-files
Repository setup
codedoctor install adds a locked pre-commit dependency group and installs
pre-commit and pre-push Git hooks. It creates missing configuration and preserves
existing hooks, comments, hook arguments, and the project's Python support range.
Running it again does not duplicate hooks.
The installer writes Ruff, ty, basedpyright, and pyrefly settings from the
package's bundled policy into pyproject.toml. It also configures pytest,
coverage floors, and mutation source selection. That policy comes from Loop's
canonical configuration, with checkout-specific paths removed. Existing project
settings remain overrides; installation reports their names.
Codedoctor is development tooling, not an application dependency. Applications
can use their own user-directory helpers or inline XDG handling. The installer
uses the project name for userdirs-namespace.namespace; set it explicitly in
[tool.houselint] to choose another namespace. xdg-literal.helper is unset
unless the project requires a shared helper.
Setup uses the same hook configuration as this repository, without its package-export and Rust-only checks. Commits autofix whitespace, spelling, notebooks, house lint, and Ruff formatting; check types with ty, pyrefly, and basedpyright; and run paired tests, coverage checks, and sampled mutation tests. Pushes run repository-wide type checks and the fast, slow, smoke, and integration test tiers. Dependency-graph setup precedes affected-file checks.
Tests may use either test_*.py or *_test.py; existing discovery settings and
coverage thresholds are preserved. Hooks that rewrite files abort that attempt;
review and stage the changes, then retry.
rekursiv-ai-typings is optional, not a Codedoctor dependency. The Quickstart
adds it explicitly to the development-tools group. This also works for projects
supporting Python below 3.12; those targeting 3.12+ can use uv add --dev
instead.
Alternatively, install Codedoctor in the project's environment first:
uv add --dev codedoctor
uv run codedoctor install
Codedoctor requires Python 3.12 or newer. For projects supporting older Python,
use the uvx route: its tools live in a Python 3.12+ dependency group without
raising the application's runtime floor. Git and uv must already be installed.
Policy updates
Policy changes reach projects through a new Codedoctor release. Upgrade the locked dependency, then reinstall:
uv lock --upgrade-package codedoctor
uv run --group pre-commit codedoctor install
uv run --group pre-commit codedoctor check
[tool.codedoctor.managed] records the last generated defaults. Reinstallation
updates unchanged managed settings and adds new defaults. It preserves project
overrides and deliberately deleted settings. Lists are replaced as whole values;
a customized list remains an override. Do not edit the recorded baseline.
codedoctor check exits nonzero when the installed package would refresh the
project configuration. It does not write files or install dependencies. Preserved
overrides do not make configuration stale.
pre-commit calls a hook once per chunk of file names, so --all-files starts a
type checker or pytest several times over. Each heavy gate here is two hooks: a
-spool twin collects every chunk, then the gate runs once over all of them,
at this machine's worker count.
Example
A .pre-commit-config.yaml pair for ty:
repos:
- repo: local
hooks:
- id: ty-check-spool
name: ty-check-spool
alias: ty-check
language: system
require_serial: true
types_or: [python, pyi]
entry: uv run python -m codedoctor.gate spool ty-check
- id: ty-check
name: ty-check
language: system
require_serial: true
pass_filenames: false
types_or: [python, pyi]
entry: uv run python -m codedoctor.typecheck ty-check
This repository's own .pre-commit-config.yaml wires
every gate and is the fullest example.
Gates
| Module | Runs |
|---|---|
codedoctor.gate |
spool, run and threaded: the shared machinery |
codedoctor.typecheck |
ty-check, pyrefly-check, basedpyright |
codedoctor.testing |
the tests paired with each changed file, whole-suite tiers, and the pytest plugin that selects and records node ids |
codedoctor.coverage_floor |
each changed source's coverage by its own tests, read from the pytest gate's run |
codedoctor.mutation |
mutation testing of the changed functions (codedoctor[mutation]) |
codedoctor.lint |
houselint, AST rules configured in [tool.houselint] |
codedoctor.assert_isinstance |
deletes each assert isinstance a checker proves redundant |
codedoctor.affected |
the tests and files a change reaches, from a CodeGraph index |
codedoctor.nbstripout |
notebook output stripping |
Worker counts: WORKERS_<HOOK_ID> wins, then WORKERS_DEFAULT, then a count
derived from the machine's cores and free memory.
Install
uv add --dev codedoctor
If you're missing uv,
- Mac
brew install uv
- Linux
sudo apt install -y curl curl -LsSf https://astral.sh/uv/install.sh | sh
Or with pip,
python -m pip install codedoctor
Metadata
Release files for codedoctor 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| codedoctor-0.1.4.tar.gz | 705.0 kB | With provenance | Details for codedoctor-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| codedoctor-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for codedoctor-0.1.4-py3-none-any.whl |
Total release size: 1.0 MB
Release files / codedoctor-0.1.4.tar.gz
| Download URL | codedoctor-0.1.4.tar.gz |
|---|---|
| Size | 705.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a3929bcd2adf2c2fb0f5e8139762c69b2990c1bb78ab95b2acd6f322fc01ab2
|
|
BLAKE2b-256 checksum How to use checksums |
5087df97350799fe3ae5d649a38c58152160562d210d2b0f3b6660811f5293c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logRelease files / codedoctor-0.1.4-py3-none-any.whl
| Download URL | codedoctor-0.1.4-py3-none-any.whl |
|---|---|
| Size | 303.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a577fcf8810d52bdb733121cfca97acf74b8f8f5dbcf1544e19bc731e3dcf899
|
|
BLAKE2b-256 checksum How to use checksums |
b8946286fcfdd2953082c49b72bf788fa040701a7955a9ef8bb0e6616ddd8d57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logSecurity for codedoctor 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for codedoctor-0.1.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.