https://github.com/soda480/pybuilder-anybadge
A pybuilder plugin that generates badges for your pyb project.
https://github.com/soda480/pybuilder-anybadge
badge-generator pybuilder pybuilder-plugin python
Last synced: 11 months ago
JSON representation
A pybuilder plugin that generates badges for your pyb project.
- Host: GitHub
- URL: https://github.com/soda480/pybuilder-anybadge
- Owner: soda480
- License: apache-2.0
- Created: 2021-03-12T21:29:58.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-03-22T21:36:01.000Z (about 2 years ago)
- Last Synced: 2024-10-10T09:32:58.671Z (over 1 year ago)
- Topics: badge-generator, pybuilder, pybuilder-plugin, python
- Language: Python
- Homepage:
- Size: 104 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pybuilder-anybadge
[](https://github.com/soda480/pybuilder-anybadge/actions)
[](https://badge.fury.io/py/pybuilder-anybadge)
[](https://www.python.org/downloads/)
A pybuilder plugin that generates badges for your project. The plugin will generate badges using [shields.io](https://shields.io/). However it can also create badges using [anybadge](https://pypi.org/project/anybadge/) if configured to do so.
To add this plugin into your pybuilder project, add the following line near the top of your build.py:
```python
use_plugin('pypi:pybuilder_anybadge')
```
**NOTE** if you are using Pybuilder version `v0.11.x`, then specify the following version of the plugin:
```python
use_plugin('pypi:pybuilder_anybadge', '~=0.1.6')
```
### Pybuilder anybadge properties
The pybuilder task `pyb anybadge` will use anybadge to generate badges for your project by processing reports produced from various plugins; the badges that are currently supported are:
- **complexity** - requires the [pybuilder_radon](https://pypi.org/project/pybuilder-radon/) plugin. Generate badge using cyclomatic complexity score of your most complicated function.
- **vulnerabilities** - requires the [pybuilder_bandit](https://pypi.org/project/pybuilder-bandit/) plugin. Generate badge using number of security vulnerabilities discovered by vulnerabilities.
- **coverage** - requires the `coverage` plugin. Generate badge for overall unit test coverage.
- **python** - Generate badge for version of Python being used
The plugin will write the respective badges to the `docs/images` folder. The following plugin properties are available to further configure badge generation.
Name | Type | Default Value | Description
-- | -- | -- | --
anybadge_exclude | str | '' | Comma delimited string of badges to exclude from processing, valid values are 'complexity', 'vulnerabilities', 'coverage' and 'python'
anybadge_complexity_use_average | bool | False | Use overall average complexity as score when generating complexity badge
anybadge_use_shields | bool | True | Will use `img.shields.io` to create the badges, if False will use `anybadge`
**Note** the plugin will add the badge references but you must commit/push the changes (including svg files in the docs/images folder)
The plugin properties are set using `project.set_property`, the following is an example of how to set the properties:
```Python
project.set_property('anybadge_exclude', 'vulnerabilities,coverage')
project.set_property('anybadge_complexity_use_average', True)
project.set_property('anybadge_use_shields', True)
```
By default the plugin will use `shields.io` to create the badges:
[](https://pybuilder.io/)
[](https://radon.readthedocs.io/en/latest/api.html#module-radon.complexity)
[](https://pypi.org/project/bandit/)
[](https://www.python.org/downloads/)
However, setting `anybadge_use_shields` to `False` will render the badges using `anybadge` and save them as svg files in the `docs\images` folder:




### Development
Clone the repository and ensure the latest version of Docker is installed on your development server.
Build the Docker image:
```sh
docker image build \
-t \
pybanybadge:latest .
```
Run the Docker container:
```sh
docker container run \
--rm \
-it \
-v $PWD:/code \
pybanybadge:latest \
bash
```
Execute the build:
```sh
pyb -X
```