Skip to main content

Interactive command builders for Sphinx documentation

Project description

sphinx-dynamic-command-builder

PyPI

Interactive command builders for Sphinx documentation.

sphinx-dynamic-command-builder adds a dynamic-command directive that renders a small selector UI from YAML and updates a generated command in the browser. It is useful for docs that need to show command-line examples assembled from several independent choices.

Demo: GitHub Pages

Install

pip install sphinx-dynamic-command-builder

Then enable the extension in conf.py:

extensions = [
    "sphinx_dynamic_command_builder",
]

Usage

```{dynamic-command}
base: python -m sglang.launch_server --model-path [model_path]
format:
  line_break: options
  indent: "  "
options:
  - label: Topology
    key: nodes
    default: single
    choices:
      - label: Single node
        value: single
        args: --host 0.0.0.0 --port 30000
      - label: Multi node
        value: multi
        args: --host 0.0.0.0 --port 30000 --disaggregation-ib-device mlx5_1
```

Each option group is rendered as one selector row. Selecting a choice updates the generated command.

YAML schema

See Configuration for the full field reference and formatting rules.

  • base: base command string.
  • command_label: optional output label. Defaults to Generated command.
  • format.line_break: optional command wrapping mode. Use options to put each --option group on its own shell-continuation line, or none to render a single line. Defaults to options.
  • format.indent: optional indentation for continuation lines. Defaults to two spaces.
  • options: list of option groups.
  • options[].label: visible group label.
  • options[].key: stable group key.
  • options[].default: optional default choice value. Defaults to the first choice.
  • options[].choices: list of choices.
  • choices[].label: visible choice label.
  • choices[].value: stable choice value.
  • choices[].env: optional text prepended before the base command.
  • choices[].args: optional text appended after the base command.
  • choices[].base: optional replacement base command for this choice.

Development

uv venv
uv pip install -e ".[test,docs]"
pytest
sphinx-build -M html docs docs/_build

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_dynamic_command_builder-0.2.1.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file sphinx_dynamic_command_builder-0.2.1.tar.gz.

File metadata

File hashes

Hashes for sphinx_dynamic_command_builder-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d1fcef0d0d3c67b56bc45f2984d89b47f8a856ef9192b0cbaa3d41e17ba14028
MD5 3da76468fe210c014f5fd9b4c39d5eeb
BLAKE2b-256 9f6892354e3eac5d598f85eb28f90508d531913f3ca61e379a1455c0f151d955

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_dynamic_command_builder-0.2.1.tar.gz:

Publisher: publish.yml on Aionw/sphinx-dynamic-command-builder

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_dynamic_command_builder-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_dynamic_command_builder-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a17a37395ca50b6e053ce183f920e5873887fc92042cd2939fd6e47842f6794
MD5 90938679c6ee4a6143d8acaf21445646
BLAKE2b-256 f3f09a05b3797bdee8096b68848e0eb318276bea717616f8a0bc9746700267bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_dynamic_command_builder-0.2.1-py3-none-any.whl:

Publisher: publish.yml on Aionw/sphinx-dynamic-command-builder

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