Skip to main content

Bootstrap-style status badges for Sphinx documentation

Project description

sphinx-badges

Bootstrap-style status badges for Sphinx documentation.

Attach coloured badges to any API element, filter a toctree or autosummary table by badge group with a single click, and add per-group icons and tooltips to make status immediately scannable.

PyPI version Ruff Ruff Format

Documentation

Installation

pip install sphinx-badges

Or with uv:

uv add sphinx-badges

Quick start

  1. Add the extension to conf.py:

    extensions = ["sphinx_badges"]
    
  2. Define grouped badges in conf.py:

    badges_group_labels = {
        "stability": {
            "label": "Stability",
            "tooltip": "API stability level",
            "icon": "⚡",        # prepended to every badge in this group
        },
        "area": {
            "label": "Area",
            "tooltip": "Functional area",
        },
    }
    
    badges_definitions = {
        "stability:stable":       {"label": "Stable",       "color": "#198754", "text_color": "#fff"},
        "stability:experimental": {"label": "Experimental", "color": "#ffc107", "text_color": "#000"},
        "area:core":              {"label": "Core",         "color": "#6f42c1", "text_color": "#fff"},
        "area:utils":             {"label": "Utils",        "color": "#fd7e14", "text_color": "#fff"},
    }
    

    Badge IDs use a group:name format. badges_group_labels maps group keys to display labels shown above each row of filter buttons. Each group can also carry an icon (prepended to every badge in the group) and a tooltip (shown on hover). Per-badge icon and tooltip can be set directly in badges_definitions to override the group-level values.

    Ungrouped IDs (no colon) are also supported for simpler setups.

  3. Attach badges to a page:

    my_function
    ===========
    
    .. badges:: stability:stable area:core
    
    Description here.  Also inline: :badge:`stability:stable`.
    
  4. Filter a toctree by badge group:

    .. badge-filter:: stability:stable stability:experimental area:core area:utils
       :filter-mode: or
    
       .. toctree::
    
          api/module_a
          api/module_b
    

    Each group renders as its own labelled row of filter buttons. filter-mode can be or (any active badge matches) or and (all active badges must match; default).

  5. Add badges via numpy-style docstrings (autodoc):

    def my_function(x, y):
        """Return the sum.
    
        Badges
        ------
        stability:stable area:core
        """
    

Licence

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_badges-0.1.1.tar.gz (90.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_badges-0.1.1-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_badges-0.1.1.tar.gz.

File metadata

  • Download URL: sphinx_badges-0.1.1.tar.gz
  • Upload date:
  • Size: 90.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sphinx_badges-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9d61d81fd82aab5c60efc71aaeacac6b7c1fcb983d4ae94f8cb803bf8cadc11b
MD5 712bf667011b02b08bf3172542a73a68
BLAKE2b-256 6de68b01a5052c17fca192dd632160a1df3db9a595098d763817ee7540305009

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_badges-0.1.1.tar.gz:

Publisher: publish.yml on NickGeneva/sphinx-badges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sphinx_badges-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sphinx_badges-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sphinx_badges-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8c7a89cc809ef266934dd58885a4b55b29fe9161527b2ff301d399cd66c2d8af
MD5 bf7e8c9209257c47bf2ff237af03d3e7
BLAKE2b-256 ba56f1f6c6444b9b6a5d395556da124c2f0c43f7e3a8e0a740095932e0f49a9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_badges-0.1.1-py3-none-any.whl:

Publisher: publish.yml on NickGeneva/sphinx-badges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page