Skip to main content

Generate coverage badges for

Project description

Build status PyPI Downloads

A small script to generate coverage badges using Example of a generated badge:

Example coverage badge

The badge template has been taken from, therefore it should look mostly good. (The spec is a bit stricter on the margins, but I can’t easily do text width calculations in Python so the margins might not always be 4px.)

:arrow_right: Note: If you need a script with a few more features (e.g. test badges, flake8 reports, etc), check out genbadge.



pip install coverage-badge


First, run to generate the necessary coverage data. Then you can either return the badge SVG to stdout:

$ coverage-badge

…or write it to a file:

$ coverage-badge -o coverage.svg

It’s important that you run coverage-badge from the directory where the .coverage data file is located.

Different colors for cover ranges:

15% 45% 65% 80% 93% 97%

The full usage text:

usage: [-h] [-o FILEPATH] [-p] [-f] [-q] [-v]

Generate coverage badges for

optional arguments:
  -h, --help   show this help message and exit
  -o FILEPATH  Save the file to the specified path.
  -p           Plain color mode. Standard green badge.
  -f           Force overwrite image, use with -o key.
  -q           Don't output any non-error messages.
  -v           Show version.


MIT License, see LICENSE.txt file..

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coverage-badge-1.1.0.tar.gz (5.4 kB view hashes)

Uploaded source

Built Distribution

coverage_badge-1.1.0-py2.py3-none-any.whl (6.4 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page