How to

Pipeline position

Hooks doctree-resolved at priority 600, after sphinx-autodoc-api-style at 500. Consumes the api_slot nodes that producer packages inject into desc_signature during earlier transforms, and composes them into the final gp-sphinx-api-layout-right subcomponent (badges, source link, permalink).

The extension also overrides Sphinx’s built-in desc_signature HTML visitor (app.add_node(addnodes.desc_signature, override=True, ...)). This is a deliberate platform decision: taking ownership of signature rendering allows the gp-sphinx-api-link permalink to be placed inside the managed layout rather than appended by Sphinx’s default handler.

Event

Hook

Priority

doctree-resolved

on_doctree_resolved

600 (after api-style at 500)

object-description-transform

not used

Downstream conf.py

With gp-sphinx:

conf = merge_sphinx_config(
    project="my-project",
    version="1.0.0",
    copyright="2026, Your Name",
    source_repository="https://github.com/your-org/my-project/",
    extra_extensions=["sphinx_ux_autodoc_layout"],
    api_layout_enabled=True,
    api_collapsed_threshold=10,
)

Or without merge_sphinx_config:

extensions = ["sphinx.ext.autodoc", "sphinx_ux_autodoc_layout"]
api_layout_enabled = True

Configuration

Generated from app.add_config_value() registrations in sphinx_ux_autodoc_layout/__init__.py.

api_layout_enabled
config env
config env
api_layout_enabled

Master switch for the componentized autodoc layout. When True, desc nodes emitted by domain autodocumenters are wrapped in api_region / api_signature / api_fold containers; when False, default Sphinx rendering is preserved unchanged.

Type:

bool

Default:

False

Registered by:

sphinx_ux_autodoc_layout.setup()

api_fold_parameters
config env
config env
api_fold_parameters

When True, parameter lists exceeding api_collapsed_threshold items are wrapped in a click-to-expand <details> element. Set to False to render every parameter inline regardless of count.

Type:

bool

Default:

True

Registered by:

sphinx_ux_autodoc_layout.setup()

api_collapsed_threshold
config env
config env
api_collapsed_threshold

Minimum number of parameters before api_fold_parameters=True collapses the list. Has no effect when folding is disabled.

Type:

int

Default:

10

Registered by:

sphinx_ux_autodoc_layout.setup()

api_signature_show_annotations
config env
config env
api_signature_show_annotations

When True, signature blocks render type annotations inline next to each parameter. False strips them — useful when annotations are documented separately in a Parameters section to avoid duplication.

Type:

bool

Default:

True

Registered by:

sphinx_ux_autodoc_layout.setup()

Shared helper surface

  • build_api_card_entry() builds the shared inner api-* shell for section-card consumers such as FastMCP.

  • build_api_summary_section() wraps summary and index tables in the shared gp-sphinx-api-summary region.