diff-cover
Run coverage and linting reports on diffs
Install
diff-cover on PyPI
pip
pip install diff-coveruv
uv add diff-coverpoetry
poetry add diff-coverPackage facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — Jinja2, Pygments, chardet, pluggy |
| Maintenance | actively maintained — 5 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: diff_cover-10.5.0-py3-none-any.whl
About diff-cover
from the package's own PyPI description — quoted content, verbatim
diff-cover |pypi-version| |conda-version| |build-status|
Automatically find diff lines that need test coverage. Also finds diff lines that have violations (according to tools such as pycodestyle, pyflakes, flake8, or pylint). This is used as a code quality metric during code reviews.
Overview
Diff coverage is the percentage of new or modified lines that are covered by tests. This provides a clear and achievable standard for code review: If you touch a line of code, that line should be covered. Code coverage is every developer's responsibility!
The diff-cover command line tool compares an XML coverage report
with the output of git diff. It then reports coverage information
for lines in the diff.
Currently, diff-cover requires that:
- You are using
gitfor version control. - Your test runner generates coverage reports in Cobertura, Clover or JaCoCo XML format, or LCov format.
Supported XML or LCov coverage reports can be generated with many coverage tools, including:
- Cobertura__ (Java)
- Clover__ (Java)
- JaCoCo__ (Java)
- coverage.py__ (Python) -...
Read as markdown · JSON record · Source repository · Homepage
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
Compares test coverage and code quality reports against git diffs to measure coverage on only the lines you changed, supporting multiple coverage formats (Cobertura, Clover, JaCoCo, LCov) and quality checkers (pycodestyle, flake8, pylint, ruff).
Low friction: pure Python wheel with four common dependencies (Jinja2, Pygments, chardet, pluggy). Actively maintained with a release 5 days ago and 842 repository stars.
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must include a copy of the license and state significant changes.
Usage
pip install diff-cover
# After running tests with coverage:
pytest --cov --cov-report=xml
# Then generate diff coverage report:
diff-cover coverage.xml
Requires git repository and a coverage report in Cobertura, Clover, JaCoCo, or LCov XML format.
Verdict: Production-stable tool for enforcing test coverage on code changes during review. Actively maintained, permissive license, low install friction, and no known vulnerabilities. Supports Python 3.10–3.14 and integrates with standard coverage and linting tools.
Needs verification
- Whether the tool's performance scales acceptably with very large diffs or multiple coverage reports.
- Whether all advertised quality checkers (ruff.check, clang, checkstyle) are equally well-tested in practice.
Similar packages
permissive · top 1,000 on PyPI
beartypepermissive · top 1,000 on PyPI
mccabepermissive · top 1,000 on PyPI
unidiffpermissive · top 1,000 on PyPI
pyflakespermissive · top 1,000 on PyPI
ruffpermissive · top 1,000 on PyPI
pycodestylepermissive · top 1,000 on PyPI
pylintcopyleft · top 1,000 on PyPI
daffpermissive · top 1,000 on PyPI
yamllintcopyleft · top 1,000 on PyPI