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
```

Rendered result:

Rendered dynamic command builder

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.2.tar.gz (25.7 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.2.tar.gz.

File metadata

File hashes

Hashes for sphinx_dynamic_command_builder-0.2.2.tar.gz
Algorithm Hash digest
SHA256 c17b371c8e6eb98f1854cdac06ca01f2394c8e4fbb0e318300af37abce8d9011
MD5 04f9203afc46e0b6bc1208129453c74c
BLAKE2b-256 2e048666e61e39130fa073c00db8add5202fbef0aaa5aa38de023ab511a3a908

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sphinx_dynamic_command_builder-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 aa1d6d0c33df06ff3cc02361c7bfa5ff53c50220e62e43aff523aa372f3c3b23
MD5 d67d6fbcbc836c8639caa6a4e4e64c4a
BLAKE2b-256 038037c745ce42e60c256c9923b5c3c9844de17c71c8f571b0499af634a8290c

See more details on using hashes here.

Provenance

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