Genbadge (version 1.1.3) is a Python library that provides command-line utilities to generate badges for various development tools that may not offer them natively. It currently supports generating badges for test results (e.g., from `junit.xml`), code coverage (e.g., from `coverage.xml`), and flake8 reports. The project has an active development status with several releases per year, addressing bug fixes and adding new features.
pip install genbadgeNo compatibility data collected yet for this library.
This quickstart demonstrates how to generate a coverage badge using `genbadge` from a `coverage.xml` report. First, ensure `genbadge` is installed with `coverage` extra. Then, generate your `coverage.xml` report (e.g., using the `coverage.py` tool). Finally, run the `genbadge coverage` command, specifying the input XML file and desired output SVG file.
Upgrade your Python environment to 3.8 or newer, or use an older version of genbadge that explicitly supports your Python version.
Upgrade genbadge to version 1.1.1 or higher. If unable to upgrade genbadge, consider downgrading Pillow to a version below 10.
Upgrade genbadge to version 1.0.4 or higher to correctly handle coverage reports with zero branches.
Upgrade genbadge to version 1.1.1 or higher. Alternatively, ensure `setuptools` is explicitly installed in your environment (`pip install setuptools`).
Upgrade genbadge to version 1.1.3 or higher, which migrates to `importlib.resources`.
Validate your XML report file using an XML validator to identify and correct malformed tags, ensuring proper XML structure and escaping any special characters. Ensure the file encoding matches the XML declaration.
Upgrade `genbadge` to version 1.0.4 or newer using `pip install --upgrade genbadge`. This version includes a fix for this specific edge case in coverage calculation.
Ensure `genbadge` is installed (`pip install genbadge`) and that Python's script directory (where executables like `genbadge` are placed) is included in your system's PATH. Alternatively, execute it using `python -m genbadge <command>`.
Verify that your report file exists at the specified location. If it's in a different path, use the `-i` or `--input-file` option to explicitly provide the correct path to `genbadge` (e.g., `genbadge tests -i my_custom_reports/tests.xml`).
Ensure the input file exists at the provided path. If it's a report, generate it first using your testing or coverage tool before running `genbadge`.