{"id":24989111,"url":"https://github.com/engineervix/readme-coverage-badger","last_synced_at":"2025-04-12T00:20:47.978Z","repository":{"id":37031459,"uuid":"383483759","full_name":"engineervix/readme-coverage-badger","owner":"engineervix","description":"automatically generates your project's coverage badge using the shields.io service, and then updates your README","archived":false,"fork":false,"pushed_at":"2024-12-03T00:28:58.000Z","size":475,"stargazers_count":12,"open_issues_count":5,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-06T20:57:10.672Z","etag":null,"topics":["badge-generator","badges","coverage","python","shieldsio"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/engineervix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-06T13:46:05.000Z","updated_at":"2024-07-05T01:00:51.000Z","dependencies_parsed_at":"2023-09-26T13:37:38.155Z","dependency_job_id":"6ef66e88-524b-4b91-8b20-183863f0813b","html_url":"https://github.com/engineervix/readme-coverage-badger","commit_stats":{"total_commits":59,"total_committers":6,"mean_commits":9.833333333333334,"dds":"0.23728813559322037","last_synced_commit":"6f6c0b76ebc5493d39231b69382c952a94984ced"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/engineervix%2Freadme-coverage-badger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/engineervix%2Freadme-coverage-badger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/engineervix%2Freadme-coverage-badger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/engineervix%2Freadme-coverage-badger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/engineervix","download_url":"https://codeload.github.com/engineervix/readme-coverage-badger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248498082,"owners_count":21114033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["badge-generator","badges","coverage","python","shieldsio"],"created_at":"2025-02-04T12:16:53.569Z","updated_at":"2025-04-12T00:20:47.951Z","avatar_url":"https://github.com/engineervix.png","language":"Python","readme":"\u003ch1 align=\"center\"\u003eWelcome to README Coverage Badger 👋\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://pypi.python.org/pypi/readme-coverage-badger\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://img.shields.io/pypi/v/readme-coverage-badger.svg\" alt=\"PyPi\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/readme-coverage-badger\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://img.shields.io/pypi/pyversions/readme-coverage-badger\" alt=\"PyPI - Python Version\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/engineervix/readme-coverage-badger/actions/workflows/main.yml\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://github.com/engineervix/readme-coverage-badger/actions/workflows/main.yml/badge.svg\" alt=\"Build Status\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/engineervix/readme-coverage-badger\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://codecov.io/gh/engineervix/readme-coverage-badger/branch/master/graph/badge.svg\" alt=\"codecov\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://results.pre-commit.ci/latest/github/engineervix/readme-coverage-badger/master\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://results.pre-commit.ci/badge/github/engineervix/readme-coverage-badger/master.svg\" alt=\"pre-commit.ci status\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pyup.io/repos/github/engineervix/readme-coverage-badger/\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://pyup.io/repos/github/engineervix/readme-coverage-badger/shield.svg\" alt=\"Updates\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/readme-coverage-badger\" target=\"_blank\"\u003e\n  \u003cimg alt=\"PyPI - Downloads\" src=\"https://img.shields.io/pypi/dm/readme-coverage-badger\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/engineervix/readme-coverage-badger/commits/master\" target=\"_blank\"\u003e\n  \u003cimg alt=\"GitHub commits since latest release (by SemVer)\" src=\"https://img.shields.io/github/commits-since/engineervix/readme-coverage-badger/latest/master\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://opensource.org/licenses/BSD-3-Clause\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-BSD%203--Clause-blue.svg\" alt=\"License\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/psf/black\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/code%20style-black-000000.svg\" alt=\"Code style: black\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://conventionalcommits.org\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square\" alt=\"Conventional Commits\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://commitizen-tools.github.io/commitizen/\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/commitizen-friendly-brightgreen.svg\" alt=\"Commitizen friendly\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n\u003e Generates a coverage badge using coverage.py and the shields.io service. Your README file is then updated with the generated badge.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/engineervix/readme-coverage-badger/blob/assets/demo.gif\" alt=\"demo.gif\"\u003e\n\u003c/p\u003e\n\u003c!-- ![demo.gif](../assets/demo.gif?raw=true) --\u003e\n\n**Source Code**: [github.com/engineervix/readme-coverage-badger](https://github.com/engineervix/readme-coverage-badger)\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n**Contents** _generated with [DocToc](https://github.com/thlorenz/doctoc)_\n\n- [Why this project?](#why-this-project)\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n- [💻 Development](#-development)\n  - [First things first](#first-things-first)\n  - [Getting Started](#getting-started)\n  - [Tests](#tests)\n  - [Code Formatting](#code-formatting)\n- [Author](#author)\n- [🤝 Contributing](#-contributing)\n- [Show your support](#show-your-support)\n- [✅ TODO](#-todo)\n  - [core](#core)\n  - [docs](#docs)\n  - [other](#other)\n- [📝 License](#-license)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Why this project?\n\nThere are so many excellent coverage badge generation tools out there, why do we need another one? Well, at the time of writing this package (circa early 2021), all the existing tools (for example, [coverage-badge](https://github.com/dbrgn/coverage-badge)) I had come across ended at generating SVG/PNG files/strings/Base64 images. What you do with this remains entirely up to you.\n\nNow, it is often much easier to simply use online services such as [codecov.io](https://about.codecov.io/) and [coveralls.io](https://coveralls.io/). These services are free for open source projects, but require a monthly subscription for private repos. Many times, we work on private repos, and we wanna be able to automatically have coverage badges in our READMEs. What if you are unable to pay such subscription fees, or maybe you don't want to use a SaaS? Your solution becomes to generate your own badge!\n\nThis is where this project comes in. It **automatically generates your project's coverage badge using the [shields.io](https://shields.io/) service, and then updates your README** accordingly, in just one command! That's all it does, resonating with the Unix philosophy of doing one thing and doing it well. The main idea for this came from [istanbul-badges-readme](https://github.com/olavoparno/istanbul-badges-readme), which does exactly the same thing for JavaScript projects. You will see that these two projects have quite a lot in common.\n\nAfter using [istanbul-badges-readme](https://github.com/olavoparno/istanbul-badges-readme), I searched for a python alternative but couldn't find anything suitable. The closest I found was [coverage-badge](https://github.com/dbrgn/coverage-badge), and if you look at this project's code, you will see a lot of similarities with [coverage-badge](https://github.com/dbrgn/coverage-badge)!\n\nIf what you're looking for is a powerful, _general purpose badge generation tool_ for your projects, then you should probably check out projects like [anybadge](https://github.com/jongracecox/anybadge) and [genbadge](https://github.com/smarie/python-genbadge/).\n\n## Features\n\n- automatically generates your project's coverage badge using the [shields.io](https://shields.io/) service, and then updates your project's README with the newly generated badge\n- simple CLI tool (`readme-cov`) with helpful messages\n- tested on python 3.8 to 3.12 with coverage ≥ 84%\n- free software: BSD-3-Clause license\n- generates different colours depending on the coverage percentage. Optionally generate plain colour (green) regardless of percentage\n- minimal external dependencies – this tool only has 2 external dependencies; [Coverage.py](https://github.com/nedbat/coveragepy) (obviously!) and [colorama](https://github.com/tartley/colorama) (for cross-platform coloured terminal output)\n\nThe table below shows the coverage thresholds, associated colours and examples of generated badges:\n\n| Coverage            | Colour      | Example                                                                                    |\n| ------------------- | ----------- | ------------------------------------------------------------------------------------------ |\n| 0 ≤ coverage \u003c 40   | red         | ![Code Coverage Red ](https://img.shields.io/badge/Coverage-13%25-red.svg)                 |\n| 40 ≤ coverage \u003c 60  | orange      | ![Code Coverage Orange ](https://img.shields.io/badge/Coverage-46%25-orange.svg)           |\n| 60 ≤ coverage \u003c 75  | yellow      | ![Code Coverage Yellow ](https://img.shields.io/badge/Coverage-69%25-yellow.svg)           |\n| 75 ≤ coverage \u003c 90  | yellowgreen | ![Code Coverage Yellow Green](https://img.shields.io/badge/Coverage-85%25-yellowgreen.svg) |\n| 90 ≤ coverage \u003c 95  | green       | ![Code Coverage Green](https://img.shields.io/badge/Coverage-91%25-green.svg)              |\n| 95 ≤ coverage ≤ 100 | brightgreen | ![Code Coverage Bright Green](https://img.shields.io/badge/Coverage-96%25-brightgreen.svg) |\n\n## Installation\n\n```sh\npip install readme-coverage-badger\n```\n\n## Usage\n\n**Note**: Before using the tool, ensure that you insert a string of the form `![Code Coverage]()` or `![Code Coverage](anything here)` in your project's README.\n\n```txt\nreadme-cov [-h] [-v] [-p]\n\noptional arguments:\n  -h, --help     show the help message and exit\n  -v, --version  show program's version number and exit\n  -p, --plain    Plain colour mode. Standard green badge.\n```\n\nThe tool operates on the basis of the following assumptions:\n\n- you have a README.md or README file at the root of your project\n- your README file is in markdown format. I know, some Pythonistas prefer restructuredtext! Sadly, this isn't supported (yet)\n- Somewhere in your your README is a string in the form: `![Code Coverage]()` or `![Code Coverage](anything here)`. This is what gets updated in-place (using [`re.sub()`](https://docs.python.org/3.12/library/re.html#re.sub)) when the script runs.\n- the script is called from the root of your project repo, which has coverage.py already configured, and the coverage already updated (you have already run your tests prior to running the script)\n- If the coverage badge in your README file is already up to date, your README file won't be updated, you will only be notified\n\n## 💻 Development\n\n### First things first\n\n- ensure that you have [Python 3.8+](https://www.python.org/) on your machine, and that you are able to configure python [**virtual environment**](https://realpython.com/python-virtual-environments-a-primer/)s.\n- ensure that you have [git](https://git-scm.com/) setup on your machine.\n\n### Getting Started\n\nFirst, [fork](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/fork-a-repo) this repository, then fire up your command prompt and ...\n\n1. Clone the forked repository\n2. Navigate to the cloned project directory: `cd readme_coverage_badger`\n3. activate your python virtual environment and `pip install --upgrade pip`\n4. Install dependencies: `pip install -r requirements_dev.txt`\n5. Setup [pre-commit](https://pre-commit.com/) by running `pre-commit install` followed by `pre-commit install --hook-type commit-msg`. Optionally run `pre-commit run --all-files` to make sure your pre-commit setup is okay.\n\nAt this stage, hopefully everything should be working fine, and you should be able to start hacking on the project.\n\nYou can run the application via `invoke run` or\n\n```sh\npython readme_coverage_badger/__main__.py\n```\n\n### Tests\n\nSimply run `pytest` or `invoke test` to run tests in your virtual environment.\n\nTest other Python versions by running `tox`.\n\n### Code Formatting\n\n- Run `invoke lint` to run [`flake8`](https://flake8.pycqa.org/en/latest/), [`black`](https://black.readthedocs.io/en/stable/), [`isort`](https://pycqa.github.io/isort/) and [`mypy`](https://mypy.readthedocs.io/en/stable/) on the code.\n- If you get any errors from `black` and/or `isort`, run `invoke lint --fix` or `invoke lint -f` so that black and isort can format your files. Alternatively, just run `pre-commit`. You can take a look at [.pre-commit-config.yaml](https://github.com/engineervix/readme-coverage-badger/blob/master/.pre-commit-config.yaml).\n\n## Author\n\n👤 **Victor Miti**\n\n- Blog: \u003chttps://blog.victor.co.zm\u003e\n- Twitter: [![Twitter: engineervix](https://img.shields.io/twitter/follow/engineervix.svg?style=social)](https://twitter.com/engineervix)\n- Github: [@engineervix](https://github.com/engineervix)\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are most welcome! A good place to start is by helping out with the unchecked items in the [TODO](#-todo) section of this README!\n\nFeel free to check the [issues page](https://github.com/engineervix/readme-coverage-badger/issues) and take a look at the [contributing guide](https://github.com/engineervix/readme-coverage-badger/blob/master/CONTRIBUTING.md) before you get started. In addition, please note the following:\n\n- if you're making code contributions, please try and write some tests to accompany your code, and ensure that the tests pass. Also, were necessary, update the docs so that they reflect your changes.\n- commit your changes via `cz commit`. Follow the prompts. When you're done, `pre-commit` will be invoked to ensure that your contributions and commits follow defined conventions. See `pre-commit-config.yaml` for more details.\n- your commit messages should follow the conventions described [here](https://www.conventionalcommits.org/en/v1.0.0/). Write your commit message in the imperative: \"Fix bug\" and not \"Fixed bug\" or \"Fixes bug.\" This convention matches up with commit messages generated by commands like `git merge` and `git revert`.\n  Once you are done, please create a [pull request](https://github.com/engineervix/readme-coverage-badger/pulls).\n\n## Show your support\n\nPlease give a ⭐️ if this project helped you!\n\n## ✅ TODO\n\n### core\n\n- [ ] Cater for not only markdown but also restructuredtext, and automatically detect if a file's syntax is markdown or restructuredtext if no extension given\n- [ ] Provide option to generate badge in HTML format\n- [ ] Provide option to generate to `stdout` and skip substitution in a README file. This could be useful if you're using the tool in a script and you just want the result so that you can use it elsewhere.\n- [ ] Allow for flexibility in choosing whatever colours one wants\n- [ ] Allow for specifying _Alt Text_ on the badge URL, for example `![Alt Text]()` or `![Alt Text](anything here)`\n- [ ] Make the codebase fully typed\n- [ ] Improve the Tests by [parametrizing](https://docs.pytest.org/en/stable/example/parametrize.html) fixtures and test functions\n- [x] improve CI/CD to cater for GNU/Linux, Mac OS X and Windows\n- [ ] Create pre-commit hook\n\n### docs\n\n- [x] Add a screenshot / demo in this README\n- [ ] Create standalone documentation for hosting either on Github Pages or readthedocs. This README is already detailed enough to serve as documentation!\n\n### other\n\n- [ ] It would be fun if we had some kind of a [badger](https://en.wikipedia.org/wiki/Badger) logo!\n\n## 📝 License\n\nCopyright © 2021 - present [Victor Miti](https://github.com/engineervix).\n\nThis project is licensed under the terms of the [BSD-3-Clause](https://github.com/engineervix/readme-coverage-badger/blob/main/LICENSE) license.\n\n---\n\n_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_\n\n---\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineervix%2Freadme-coverage-badger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fengineervix%2Freadme-coverage-badger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineervix%2Freadme-coverage-badger/lists"}