Coverage Badge

1.1.2 · maintenance · verified Mon Apr 13

coverage-badge is a Python utility that generates SVG coverage badges based on data produced by the `Coverage.py` tool. While it currently stands at version 1.1.2, the project is in maintenance mode, meaning it will receive only occasional updates and fixes, but no new features. Users seeking more advanced features or active development are encouraged to explore alternatives like `genbadge`.

Warnings

Install

Quickstart

To generate a coverage badge, first run `Coverage.py` (e.g., via `pytest --cov`) to produce coverage data. Then, execute `coverage-badge` in the same directory as the `.coverage` data file to generate the SVG image.

# 1. Run Coverage.py to generate coverage data
# (Example with pytest, ensure pytest-cov is installed if using pytest)
# pip install coverage pytest pytest-cov
coverage run -m pytest

# 2. Generate the coverage badge SVG file
#    Ensure you run this command from the directory where the .coverage data file is located.
coverage-badge -o coverage.svg

# The coverage.svg file is now generated and can be embedded in your README.md
# Example markdown: ![Coverage](coverage.svg)

view raw JSON →