{"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":"python","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-05-21T21:44:46.682Z","next_check":"2026-07-10T00:00:00.000Z","problems":[{"fix":"Upgrade to the latest version of anybadge where this issue has been resolved.","cause":"This error occurs due to a known issue in certain versions of the anybadge package where the 'get_template' function is not properly accessible.","error":"ImportError: cannot import name 'get_template' from 'anybadge.templates'"},{"fix":"Install anybadge using pip: 'pip install anybadge'.","cause":"This error occurs when the anybadge package is not installed in the Python environment.","error":"ModuleNotFoundError: No module named 'anybadge'"},{"fix":"Ensure that the 'thresholds' argument is correctly defined as a dictionary mapping numeric thresholds to color names.","cause":"This error occurs when an incorrect keyword argument is passed to the Badge class constructor in anybadge.","error":"TypeError: __init__() got an unexpected keyword argument 'thresholds'"},{"fix":"Rename your local Python file or directory from `anybadge.py` (or `anybadge`) to something else to avoid name collision with the installed library.","cause":"This error typically occurs when a local Python file or directory is named `anybadge.py` (or `anybadge`) and shadows the installed `anybadge` package, causing Python to import the local file instead of the library.","error":"ImportError: cannot import name 'Badge' from 'anybadge'"},{"fix":"Ensure you have the latest version of `anybadge` installed by running `pip install --upgrade anybadge`. If the issue persists, consider recreating your Python environment and reinstalling the package.","cause":"This error usually arises from an incompatibility after an `anybadge` update, where internal module structures or function names (like `get_template`) might have changed, or due to a corrupted or mixed installation.","error":"cannot import name 'get_template' from 'anybadge.templates'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.16.0","cli_name":"anybadge","cli_version":"0.0.0","type":"library","homepage":null,"github":"https://github.com/jongracecox/anybadge","docs":null,"changelog":null,"pypi":"https://pypi.org/project/anybadge/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"install_checks":{"last_tested":"2026-05-21","tag":null,"tag_description":null,"installed_version":"1.16.0","pypi_latest":"1.16.0","is_stale":false,"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"anybadge","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.11,"mem_mb":2.1,"disk_size":"18.8M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"anybadge","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.11,"mem_mb":2.1,"disk_size":"18.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"anybadge","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.1,"mem_mb":2.1,"disk_size":"19M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"anybadge","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.13,"mem_mb":2.1,"disk_size":"19M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"anybadge","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.18,"mem_mb":2.4,"disk_size":"20.8M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"anybadge","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.25,"mem_mb":2.4,"disk_size":"20.8M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"anybadge","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0.16,"mem_mb":2.4,"disk_size":"21M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"anybadge","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.18,"mem_mb":2.4,"disk_size":"21M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"anybadge","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.12,"mem_mb":1.9,"disk_size":"12.6M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"anybadge","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.2,"mem_mb":1.9,"disk_size":"12.6M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"anybadge","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.14,"mem_mb":1.9,"disk_size":"13M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"anybadge","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.16,"mem_mb":1.9,"disk_size":"13M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"anybadge","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.14,"mem_mb":2.7,"disk_size":"12.4M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"anybadge","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.19,"mem_mb":2.7,"disk_size":"12.3M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"anybadge","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.15,"mem_mb":2.5,"disk_size":"13M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"anybadge","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.18,"mem_mb":2.5,"disk_size":"13M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"anybadge","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.06,"mem_mb":2.2,"disk_size":"18.3M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"anybadge","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.09,"mem_mb":2.2,"disk_size":"18.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"anybadge","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0.05,"mem_mb":2.2,"disk_size":"19M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"anybadge","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.09,"mem_mb":2.2,"disk_size":"19M"}]},"_links":{"self":"https://checklist.day/api/registry/anybadge","v1":"https://checklist.day/v1/registry/anybadge","v1_install":"https://checklist.day/v1/registry/anybadge/install","v1_imports":"https://checklist.day/v1/registry/anybadge/imports","v1_compatibility":"https://checklist.day/v1/registry/anybadge/compatibility","v1_quickstart":"https://checklist.day/v1/registry/anybadge/quickstart","docs":"https://checklist.day/docs"}}