typemut
Mutation testing for Python type annotations.
Standard mutation testing tools (cosmic-ray, mutmut) mutate runtime code and check if tests catch it. typemut mutates only type annotations and checks if type checkers (mypy, pyright) catch the change.
- Mutant killed = type checker reports an error (types are strict enough)
- Mutant survived = no type error (types are too loose or type checker coverage is weak)
Documentation: https://nkhitrov.github.io/typemut/
Installation
pip install typemut
# or
uv add typemut
Quick Start
- Create
typemut.tomlin your project root:
[typemut]
module-path = "src/myproject"
test-command = "make typecheck" # must exit non-zero on type errors
checker = "mypy" # or pyright/basedpyright; needed when test-command is a wrapper like make
timeout = 30
All operators are enabled by default; see the configuration reference for every key.
- Run:
typemut run # full pipeline: discover + execute + report
typemut html --open # generate HTML report and open in browser
typemut -C /path/to/project run # or from another directory
- On a real project, run mutants on several workers (needs a clean git working tree, see Parallel runs):
typemut run --jobs 8
Features
- 8 operators — remove union/literal members, add or remove
Optional, widen types and containers, swapIterator/Generator, changeTypeVarvariance. - Type checkers — mypy, pyright, basedpyright, a generic
fallback and third-party checker plugins; mutants that break the code are
reported as
error, not as kills. - Parallel runs —
--jobs Nruns mutants in N git worktrees. - CI gating —
--fail-underand a baseline of accepted survivors. - GitHub Action —
uses: nkhitrov/typemut@<release>runs typemut incrementally and keeps the database of the default branch as an artifact. - Incremental runs —
--incrementalreuses kills whose files are unchanged, with recipes to keep the database between CI runs on GitHub Actions and GitLab CI. - Plugins — SQLAlchemy, FastAPI, FastStream, django-modern-rest, pydantic, taskiq, framework entrypoints and third-party plugins.
- Filtering — skip comments, excluded modules,
@overridesignatures, ignored types and class hierarchies per operator. - HTML report with per-mutant diffs and checker output.
- CLI reference —
run,init,exec,report,html.
Contributing
See Contributing.
Metadata
Release files for typemut 0.5.0
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 |
|---|---|---|---|---|
| typemut-0.5.0.tar.gz | 246.5 kB | With provenance | Details for typemut-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| typemut-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for typemut-0.5.0-py3-none-any.whl |
Total release size: 368.4 kB
Release files / typemut-0.5.0.tar.gz
| Download URL | typemut-0.5.0.tar.gz |
|---|---|
| Size | 246.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7703b462173b5c2c0a51d29884597eb8e04feea854708484c7a844d69b7a8dbd
|
|
BLAKE2b-256 checksum How to use checksums |
1fd948e5814ea4cf44fa1e4aec8d4aa7a813bb7d80bd2c97ebd1cdc46ddd3fe0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 27, 2026.
Transparency logRelease files / typemut-0.5.0-py3-none-any.whl
| Download URL | typemut-0.5.0-py3-none-any.whl |
|---|---|
| Size | 121.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70730e7afe7e1cbaeba900dfd64bbec2058c1ab9a2fb2fbd8885fcc42fc3a4c1
|
|
BLAKE2b-256 checksum How to use checksums |
4b48abb75c51e74d4bb379980a37ad4cc03e2595905708e8d913089a63fb9dfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 27, 2026.
Transparency logSecurity for typemut 0.5.0
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 typemut-0.5.0.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 Oct 27, 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.