Skip to main content

codedoctor🩺

PyPI version CI Python 3.12+ License: Apache-2.0 Discord

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, lint rules, and the project's Python support range. Running it again does not duplicate hooks.

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.

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

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codedoctor 0.1.3
File Size Uploaded Provenance Actions
codedoctor-0.1.3.tar.gz 691.2 kB With provenance Details for codedoctor-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for codedoctor 0.1.3
File Interpreter ABI Platform Actions
codedoctor-0.1.3-py3-none-any.whl Python 3 none any Details for codedoctor-0.1.3-py3-none-any.whl

Total release size: 987.8 kB

Release files / codedoctor-0.1.3.tar.gz

Download URL codedoctor-0.1.3.tar.gz
Size 691.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ab5986d23a291b4a7a66479ae4d5a635ee0e94e6f5b9510e59ce49d366076f18
BLAKE2b-256 checksum
How to use checksums
3248d01247b0020ca1a133d47b65e6be353d536c29c94cbe4e61d34969400c72
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 7, 2026.

Transparency log

Release files / codedoctor-0.1.3-py3-none-any.whl

Download URL codedoctor-0.1.3-py3-none-any.whl
Size 296.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab3e855a73a30c1c54ca220b1a85250afec9690d6b49e970a54ef472498e9315
BLAKE2b-256 checksum
How to use checksums
0b658710f6e64b42804d21ac2213d96c44c5b30d8d1d83869bb0a00d3f72ece5
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 7, 2026.

Transparency log

Security for codedoctor 0.1.3

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.

Select from 2 files

Attestation for codedoctor-0.1.3.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 7, 2026.

Transparency log

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

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page