Package: readme-coverage-badger
Welcome to README Coverage Badger 👋Generates a coverage badge using coverage.py and the shields.io service. Your README file is then updated with the generated badge.Source Code:github.com/engineervix/readme-coverage-badgerContentsgenerated withDocTocWhy this project?FeaturesInstallationUsage💻 DevelopmentFirst things firstGetting StartedTestsCode FormattingAuthor🤝 ContributingShow your support✅ TODOcoredocsother📝 LicenseWhy this project?There 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) I had come across ended at generating SVG/PNG files/strings/Base64 images. What you do with this remains entirely up to you.Now, it is often much easier to simply use online services such ascodecov.ioandcoveralls.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!This is where this project comes in. Itautomatically generates your project's coverage badge using theshields.ioservice, and then updates your READMEaccordingly, 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 fromistanbul-badges-readme, which does exactly the same thing for JavaScript projects. You will see that these two projects have quite a lot in common.After usingistanbul-badges-readme, I searched for a python alternative but couldn't find anything suitable. The closest I found wascoverage-badge, and if you look at this project's code, you will see a lot of similarities withcoverage-badge!If what you're looking for is a powerful,general purpose badge generation toolfor your projects, then you should probably check out projects likeanybadgeandgenbadge.Featuresautomatically generates your project's coverage badge using theshields.ioservice, and then updates your project's README with the newly generated badgesimple CLI tool (readme-cov) with helpful messagestested on python 3.6 to 3.9 with coverage ≥ 84%free software: BSD-3-Clause licensegenerates different colours depending on the coverage percentage. Optionally generate plain colour (green) regardless of percentageminimal external dependencies – this tool only has 2 external dependencies;Coverage.py(obviously!) andcolorama(for cross-platform coloured terminal output)The table below shows the coverage thresholds, associated colours and examples of generated badges:CoverageColourExample0 ≤ coverage < 40red40 ≤ coverage < 60orange60 ≤ coverage < 75yellow75 ≤ coverage < 90yellowgreen90 ≤ coverage < 95green95 ≤ coverage ≤ 100brightgreenInstallationpipinstallreadme-coverage-badgerUsageNote: 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.readme-cov [-h] [-v] [-p]

optional arguments:
  -h, --help     show the help message and exit
  -v, --version  show program's version number and exit
  -p, --plain    Plain colour mode. Standard green badge.The tool operates on the basis of the following assumptions:you have a README.md or README file at the root of your projectyour README file is in markdown format. I know, some Pythonistas prefer restructuredtext! Sadly, this isn't supported (yet)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 (usingre.sub()) when the script runs.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)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💻 DevelopmentFirst things firstensure that you havePython 3.6+on your machine, and that you are able to configure pythonvirtual environments.ensure that you havegitsetup on your machine.Getting StartedFirst,forkthis repository, then fire up your command prompt and ...Clone the forked repositoryNavigate to the cloned project directory:cd readme_coverage_badgeractivate your python virtual environment andpip install --upgrade pipInstall dependencies:pip install -r requirements_dev.txtSetuppre-commitby runningpre-commit installfollowed bypre-commit install --hook-type commit-msg. Optionally runpre-commit run --all-filesto make sure your pre-commit setup is okay.At this stage, hopefully everything should be working fine, and you should be able to start hacking on the project.You can run the application viainvoke runorpythonreadme_coverage_badger/__main__.pyTestsSimply runpytestorinvoke testto run tests in your virtual environment.Test other Python versions by runningtox.Code FormattingRuninvoke lintto runflake8,black,isortandmypyon the code.If you get any errors fromblackand/orisort, runinvoke lint --fixorinvoke lint -fso that black and isort can format your files. Alternatively, just runpre-commit. You can take a look at.pre-commit-config.yaml.Author👤Victor MitiBlog:https://importthis.techTwitter:Github:@engineervix🤝 ContributingContributions, issues and feature requests are most welcome! A good place to start is by helping out with the unchecked items in theTODOsection of this README!Feel free to check theissues pageand take a look at thecontributing guidebefore you get started. In addition, please note the following: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.commit your changes viacz commit. Follow the prompts. When you're done,pre-commitwill be invoked to ensure that your contributions and commits follow defined conventions. Seepre-commit-config.yamlfor more details.your commit messages should follow the conventions describedhere. 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 likegit mergeandgit revert.
Once you are done, please create apull request.Show your supportPlease give a ⭐️ if this project helped you!✅ TODOcoreCater for not only markdown but also restructuredtext, and automatically detect if a file's syntax is markdown or restructuredtext if no extension givenProvide option to generate badge in HTML formatProvide option to generate tostdoutand 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.Allow for flexibility in choosing whatever colours one wantsAllow for specifyingAlt Texton the badge URL, for example![Alt Text]()or![Alt Text](anything here)Make the codebase fully typedImprove the Tests byparametrizingfixtures and test functionsimprove CI/CD to cater for GNU/Linux, Mac OS X and WindowsCreate pre-commit hookdocsAdd a screenshot / demo in this READMECreate standalone documentation for hosting either on Github Pages or readthedocs. This README is already detailed enough to serve as documentation!otherIt would be fun if we had some kind of abadgerlogo!📝 LicenseCopyright © 2021Victor Miti.This project is licensed under the terms of theBSD-3-Clauselicense.This README was generated with ❤️ byreadme-md-generatorChangelogAll notable changes to this project will be documented here.The format is based onKeep a Changelog, and this project attempts to adhere toSemantic Versioning.v0.1.2(2022-01-21)📝 Docschangelog:add note on version 0.1.0 (7e7b8a6)changelog:regenerate usingstandard-version(90da4da)readme:add a GIF to demonstrate the tool (82afdbe)readme:general reorganisation of the docs – centre the badges, categorize the TODOs and add some minor improvements (d46fcbb)💄 Stylingchangelog:moveto the end of the file (aa9b442)update changelog configuration (0e0fd06)⚙️ Build Systemdeps-dev:bump faker from 8.9.1 to 8.10.0 (#3) (63c50d9)deps-dev:bump invoke from 1.5.0 to 1.6.0 (#5) (f62aa4e)deps-dev:bump isort from 5.9.1 to 5.9.2 (#4) (81837d2)deps-dev:update outdated packages (45bd516)deps-dev:update precommit hook commitizen-tools/commitizen to v2.17.12 (63cf405)deps-dev:update precommit hook commitizen-tools/commitizen to v2.17.13 (69b65cc)deps-dev:update precommit hook commitizen-tools/commitizen to v2.18.0 (50a946f)deps-dev:update precommit hook pre-commit/mirrors-isort to v5.9.2 (922f932)deps-dev:update precommit hook pycqa/isort to v5.9.3 (300dd31)🐛 Bug Fixesenforce coverage<6 and ensure python 3.10 support (e2c2f92)👷 CI/CDaddrenovate.json(#6) (194b29e)add GH action to greet first-time contributors (8085515)add manually triggered workflow (c8b3e66)add the lint job to python 3.8 on TRavis CI (0d20cbf)correct the Travis CI config to support PEP 517 builds (9e476a1)customize renovate config to allow automatic dependency management (8fcc766)disable publishing to testPyPI (00c8783)improved release workfow through some custom hacks (ee12b8e)pre-commit autoupdate (#10) (c4a52df)pre-commit.ci:pre-commit autoupdate (#12) (94c2929)removedependabot.ymlconfiguration file (bc0568b)renovate.json:fix configuration (#9) (14dd8b3)run tests on GNU/Linux, Mac OS X and Windows (2a2b446)run tests on Python 3.10 (6e93962)switch from Travis CI to GitHub Actions (ba1b1fb)travis:revert to the initial setup defined in f53d6a (4db1f32)v0.1.1(2021-07-07)📝 Docsreadme:additional badges showing PyPi download stats, supported Python versions and commit activity (5c735b2)readme:correct the Travis CI Badge URL to point to the master branch (275443e)readme:fix typo in opening paragraph of "Why this Project?" (118f9ba)readme:minor grammar improvements (ad63721)⚙️ Build System / Dependenciesdeps-dev:bump commitizen from 2.17.11 to 2.17.12 (#2) (9e769fd)🛠 Miscellaneousdeploy on PyPi only when you create (and push) new tags on master (c34224f)pyproject.toml:make isort compatible with black, just like the pre-commit configuration (ba0a438)🪠 Maintenancetravis:replacetokenwith actual username (87fddc2)🐛 Bug Fixesbug inreadme_location(df68dc2)v0.1.0(2021-07-06)🪠 Maintenanceautomatic deployment on PyPi (f53d6ae)🛠 Miscellaneousfix typo in repo name (6d9cb11)fix typos on badge URLs (d8b32ac)only install codecov on travis (8a3bd55)remove detect-aws-credentials hook (4b571d8)simplify travis setup, for now (958aa6d)use focal instead of default bionic (5116bd6)BSD 3-Clause LicenseCopyright (c) 2021, Victor Miti
All rights reserved.Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.