mutmut
mutation testing for Python 3
What it is and what it does
Mutmut is a mutation testing framework that systematically modifies your Python code and reruns your tests to see if they catch the changes. By introducing small, deliberate bugs (mutants) into your source code, it reveals whether your test suite is actually detecting problems or just achieving high line coverage without meaningful assertions. The tool integrates with pytest, remembers previous work for incremental runs, and provides an interactive terminal UI for browsing and applying mutants to disk.
You run it with simple commands—`mutmut run` to generate and test mutants, then `mutmut browse` to explore results interactively. It supports configuration via setup.cfg or pyproject.toml, allows you to exclude specific files or functions, and can filter mutants using coverage.py or type checkers like mypy to reduce noise. The main constraint is that it requires fork() support, making it unsuitable for native Windows (though WSL works).
Use it for:
- Evaluate whether your test suite would catch real bugs by running it against mutated versions of your code.
- Identify undertested functions or modules where mutants survive (tests don't fail when code is modified).
- Incrementally improve test quality by applying mutants to disk and writing tests that catch them.
- Optimize test suites by filtering mutants with coverage.py to focus on actually-executed lines.
- Validate type-checked code by filtering out mutations that static type checkers would reject anyway.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Mutmut is a mutation testing system for Python that automatically modifies your code to verify your test suite catches the changes, helping identify gaps in test coverage.
Yes. Mutmut is actively maintained, has no known vulnerabilities, low install friction, and solves a real problem—verifying that your tests actually detect bugs rather than just achieving coverage numbers. It's particularly valuable if you want to move beyond line-coverage metrics to genuine test quality. The fork() requirement and occasional Rust compilation on some architectures are minor friction, not blockers.
Install
mutmut on PyPI
pip
pip install mutmutuv
uv add mutmutpoetry
poetry add mutmutInstalling mutmut
Before you install
Low install friction with a pure-Python wheel. Active maintenance with a recent release (14 days ago) and steady development since 2016. Requires Python 3.10+. Note: libcst dependency may require a Rust compiler on some architectures (e.g., x86_64-darwin) if prebuilt binaries are unavailable.
License in practice
BSD-3-Clause (permissive) allows commercial use, modification, and distribution with minimal restrictions—suitable for most projects.
Quickstart
pip install mutmut
mutmut run
mutmut browse
Requires a system with fork() support; Windows users must run inside WSL. Some architectures may need Rust toolchain installed for libcst compilation.
Verify before relying
- Whether the interactive TUI (textual dependency) works reliably across all terminal environments and operating systems.
- Performance characteristics on large codebases—how mutation testing scales with project size and test suite complexity.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 7 — click, coverage, libcst, pytest, setproctitle, textual, toml |
| Maintenance | actively maintained — 14 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,598,450/month — #2,566 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mutmut-3.7.0-py3-none-any.whl
Keywords: mutmut, mutant, mutation, test, testing
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
cosmic-rayCosmic Ray is a mutation testing tool that…
permissive · top 15,000 on PyPI
atherisAtheris is a coverage-guided fuzzer for Python…
unclear · top 15,000 on PyPI
pytest-doctestplusA pytest plugin that runs doctests in Python…
permissive · top 15,000 on PyPI
purifyA decorator that makes object-mutating…
permissive · top 15,000 on PyPI
coverage_enable_subprocessInstalls a .pth file that automatically enables…
permissive · top 15,000 on PyPI
varcodeVarcode loads and analyzes genomic variant…
permissive · top 15,000 on PyPI
flake8-mutableA flake8 plugin that detects mutable default…
permissive · top 15,000 on PyPI
pytest-codeblocksA pytest plugin that automatically discovers…
permissive · top 15,000 on PyPI
coverage-conditional-pluginA coverage.py plugin that applies conditional…
permissive · top 15,000 on PyPI