skillfed

diff-cover

Run coverage and linting reports on diffs

diff-cover Permissive license Apache-2.0 Active 842 v10.5.0 released

Install

diff-cover on PyPI

pip

pip install diff-cover

uv

uv add diff-cover

poetry

poetry add diff-cover

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 — 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

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

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 git for 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.
diff coverage measurementtest coverage on changed linesgit diff coverage reportincremental code coveragecode review quality metricscoverage report diff analysischanged lines test coverage

Similar packages