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.1.0.tar.gz (10.6 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.1.0.tar.gz.

File metadata

File hashes

Hashes for sphinx_dynamic_command_builder-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a7a5780e622f5fa34b0f2757eec0bbced7b036444b08fa4d1a7d2efcb47a78a0
MD5 5b075948f92f0896d3a928f84c649a53
BLAKE2b-256 bcfc489463984fe78bcbc8e46809384397e7354859e048c7ae21f6fccede04a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_dynamic_command_builder-0.1.0.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_dynamic_command_builder-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd8c37f85e961eb8df40df11b761c5f3538dbad91969c769ffc66b57929c8c25
MD5 28d047ee815e4aa1789a1fdee77b9904
BLAKE2b-256 4c93e85382f2e924b32beb92d1cd32cd8d189b7de6955911e76d833462b67711

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_dynamic_command_builder-0.1.0-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