Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Generate coverage badges for

Project Description

A small script to generate coverage badges using Example of a generated 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.)


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:

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

Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
coverage_badge-0.2.0-py2.py3-none-any.whl (6.9 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Nov 29, 2016
coverage-badge-0.2.0.tar.gz (4.3 kB) Copy SHA256 Checksum SHA256 Source Nov 29, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting