Skip to main content

Generate coverage badges for Coverage.py.

Project description

Build status PyPI Downloads

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

Example coverage badge

The badge template has been taken from shields.io, 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.

Installation

Run:

pip install coverage-badge

Usage

First, run Coverage.py 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: __main__.py [-h] [-o FILEPATH] [-p] [-f] [-q] [-v]

Generate coverage badges for Coverage.py.

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.

License

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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

Details for the file coverage-badge-1.1.0.tar.gz.

File metadata

  • Download URL: coverage-badge-1.1.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for coverage-badge-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c824a106503e981c02821e7d32f008fb3984b2338aa8c3800ec9357e33345b78
MD5 5bec8d044504d683310784900e559c94
BLAKE2b-256 c553873e95d8d33d7159b95f7447395565cd5fa17d6c2ae3b8c4a3d0ee1f9921

See more details on using hashes here.

File details

Details for the file coverage_badge-1.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: coverage_badge-1.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for coverage_badge-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e365d56e5202e923d1b237f82defd628a02d1d645a147f867ac85c58c81d7997
MD5 8115fca4d13b8e68ce900c1f6d5116d6
BLAKE2b-256 e9da4e993917780d09dd833b76cd863b9d2b587d37f64a31e6af4f989aea32a0

See more details on using hashes here.

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