diff-cover
Run coverage and linting reports on diffs
Decision gist · record as of 2026-08-14
Yes. diff-cover is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a concrete code review problem. It is well-suited for teams that want to enforce incremental test coverage standards. The Apache-2.0 license poses no restrictions. Use it if you want to make coverage a per-change responsibility rather than a project-wide metric.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires git repository and a coverage report in Cobertura, Clover, JaCoCo, or LCov XML format.
- Python 3.10 or later.
- Low install friction with four lightweight runtime dependencies (Jinja2, Pygments, chardet, pluggy).
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 is permissive; you can use, modify, and distribute this package freely in commercial and private projects without restriction.
last release 2026-08-08 (6 days) · last repo commit 2026-08-08 · 842 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 24,633,287 downloads/mo, #916 on PyPI
Alternatives
Verify before relying
pip install diff-cover
# After running tests with coverage:
pytest --cov --cov-report=xml
# Generate diff coverage report:
diff-cover coverage.xml
# Or with HTML output:
diff-cover coverage.xml --format html:report.html- Whether the package can parse coverage reports from tools other than those explicitly listed (e.g., newer coverage.py versions).
- Performance characteristics when processing very large diffs or multiple coverage reports.
What it is and what it does
diff-cover is a command-line tool that bridges test coverage and code review by comparing coverage reports against git diffs. It answers the question: which lines in my pull request are not covered by tests? The tool reads XML coverage reports (from tools like coverage.py, Cobertura, JaCoCo, or lcov) and compares them against the output of git diff to identify coverage gaps in changed code. It can also run as diff-quality to report code quality violations (from pycodestyle, flake8, pylint, ruff, and others) on only the lines you modified.
The package is designed for teams that want to enforce a simple code review standard: if you touch a line, it should be tested. It generates reports in multiple formats (console, HTML, JSON, Markdown) and supports comparing against any git branch or a pre-generated diff file. It has been actively maintained since 2013 and supports Python 3.10 through 3.14.
Use it for
- Enforce test coverage standards in pull requests by failing CI if diff coverage falls below a threshold.
- Generate HTML reports showing exactly which new lines lack coverage for code review discussions.
- Combine multiple test suite coverage reports to see total coverage across a monorepo or multi-language project.
- Report code quality violations (linting, style) only on lines changed in a feature branch.
- Track coverage trends on incremental changes rather than whole-project metrics.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
diff-cover is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a concrete code review problem. It is well-suited for teams that want to enforce incremental test coverage standards. The Apache-2.0 license poses no restrictions. Use it if you want to make coverage a per-change responsibility rather than a project-wide metric.
Install
diff-cover on PyPI
Before you install
Low install friction with four lightweight runtime dependencies (Jinja2, Pygments, chardet, pluggy). Active maintenance with a release 6 days ago and consistent commit activity.
Requires git repository and a coverage report in Cobertura, Clover, JaCoCo, or LCov XML format. Python 3.10 or later.
License in practice
Apache-2.0 is permissive; you can use, modify, and distribute this package freely in commercial and private projects without restriction.
Quickstart
pip install diff-cover
# After running tests with coverage:
pytest --cov --cov-report=xml
# Generate diff coverage report:
diff-cover coverage.xml
# Or with HTML output:
diff-cover coverage.xml --format html:report.html
Verify before relying
- Whether the package can parse coverage reports from tools other than those explicitly listed (e.g., newer coverage.py versions).
- Performance characteristics when processing very large diffs or multiple coverage reports.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 4 packagesJinja2Pygmentschardetpluggy |
| Maintenance | Actively maintained 6 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 24,633,287 / month, #916 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Quality AssuranceTopic :: Software Development :: Testing |
Evidence: diff_cover-10.5.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “diff coverage analysis”
- diff-coverCompares test coverage reports against git diffs to identify which…
- pycoberturaParses Cobertura code coverage reports and compares two reports to…
- pytest-cagouleA pytest plugin that identifies which tests exercise code you've…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also pycobertura · PyDriller · pyucis · gcovr · bar-raiser · fastcov · lcov-cobertura · slipcover · pytest-cover · pytest-cagoule