{"id":3870,"library":"anybadge","title":"Anybadge","description":"Anybadge is a Python library and command-line tool designed for simple and flexible generation of SVG badges for your projects. It allows users to define custom labels, values, and configurable thresholds to color badges dynamically. The library is actively maintained, with its current version being 1.16.0, and receives regular updates.","status":"active","version":"1.16.0","language":"en","source_language":"en","source_url":"https://github.com/jongracecox/anybadge","tags":["badge","svg","generator","project-management","ci","cd","documentation"],"install":[{"cmd":"pip install anybadge","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"Badge","correct":"from anybadge import Badge"},{"note":"For direct access to the main module or `anybadge.Badge` if not importing `Badge` directly.","symbol":"anybadge","correct":"import anybadge"}],"quickstart":{"code":"import anybadge\n\n# Define thresholds for coloring the badge based on value\n# <2=red, <4=orange, <6=yellow, <10=green\nthresholds = {2: 'red', 4: 'orange', 6: 'yellow', 10: 'green'}\n\n# Create a badge instance\nbadge = anybadge.Badge(\n    label='pylint',\n    value=2.22,\n    thresholds=thresholds\n)\n\n# Write the badge to an SVG file\nbadge.write_badge('pylint.svg')\n\nprint('pylint.svg generated.')","lang":"python","description":"This example demonstrates how to create a PyLint score badge using thresholds to determine its color and then save it as an SVG file. Values can be integers, floats, or strings, and custom colors (hex codes or named colors) are supported."},"warnings":[{"fix":"Ensure your project runs on Python >= 3.4. Upgrade your Python environment if necessary.","message":"Python 2.7 support was dropped in version 1.10.0. Projects using older Python versions must upgrade to Python 3.4 or higher.","severity":"breaking","affected_versions":"<1.10.0"},{"fix":"Upgrade to anybadge v1.16.0 or newer. Ensure threshold definitions are correctly formatted (e.g., `{'value': 'color'}`).","message":"Earlier versions (prior to v1.16.0) could mishandle malformed thresholds, leading to unexpected badge colors or errors.","severity":"gotcha","affected_versions":"<1.16.0"},{"fix":"Upgrade to anybadge v1.16.0 or newer to benefit from fixes for label and value escaping.","message":"Issues with escaping special characters in badge labels and values were present in versions prior to v1.16.0, potentially causing malformed SVG output.","severity":"gotcha","affected_versions":"<1.16.0"},{"fix":"Upgrade to anybadge v1.16.0 or newer to resolve any internal package versioning inconsistencies.","message":"A package version bug was identified and fixed in v1.16.0, which might have affected how the library reported or used its own version information.","severity":"gotcha","affected_versions":"<1.16.0"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}