Registry / web-framework / sphinx-prompt

sphinx-prompt

JSON →
library1.10.2pypypi✓ verified 22d ago

Sphinx Prompt is a Sphinx directive that allows developers to add code blocks with unselectable prompts to their documentation. This ensures that readers can easily copy and paste commands without including the prompt characters. The library is actively maintained, with frequent minor releases, and is currently at version 1.10.2.

pip install sphinx-prompt
INSTALL
IMPORT
SIG · SPHINX-PROMPT
S
sphinx-prompt
web-frameworkpythonv1.10.2
Install
5.4s avg
Import
Disk
94MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.9.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 92.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 5.4s · import 0.000s · 93MB
94MB installed
● package 94MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Extension Setup
# in conf.py extensions = [ 'sphinx_prompt', # ... other extensions ]
sphinx-prompt is enabled by adding 'sphinx_prompt' to the 'extensions' list in your Sphinx project's conf.py file. There is no direct Python import for the directive itself; it's used in reStructuredText.

After installing the library and adding 'sphinx_prompt' to your `conf.py` extensions, you can use the `.. prompt::` directive in your reStructuredText files. You can specify a language (e.g., `python`, `bash`, `powershell`) and a custom prompt. If no prompt is given for a shell language, a default is used (e.g., `$` for bash, `C:\>` for batch, `PS C:\>` for powershell).

# conf.py extensions = [ 'sphinx_prompt', ] # my_document.rst .. prompt:: python >>> import sys >>> print(sys.version) 3.11.0 (main, ...) .. prompt:: bash $ $ ls -l total 0 -rw-r--r-- 1 user group 0 Jan 1 10:00 myfile.txt
Debug
Known issues
breakingVersion 1.9.0 introduced compatibility with Sphinx 8, a major release of Sphinx. Users upgrading to `sphinx-prompt` 1.9.0 or later may encounter incompatibilities if their Sphinx project is built with an older Sphinx version (prior to Sphinx 8).
fix
Ensure your Sphinx installation is compatible with `sphinx-prompt`. For `sphinx-prompt` 1.9.0+, consider upgrading Sphinx to version 8 or later. For older Sphinx versions, use an earlier `sphinx-prompt` release.
affects: >=1.9.0
breakingThe minimum required Python version for `sphinx-prompt` was updated to Python >= 3.11 in recent releases (specifically, 1.10.x). Earlier versions of `sphinx-prompt` (e.g., 1.8.0) supported Python 3.9.
fix
Upgrade your Python environment to 3.11 or newer if you wish to use `sphinx-prompt` 1.10.0 or later. Alternatively, pin your `sphinx-prompt` version to an earlier release compatible with your Python version (e.g., `<1.10.0` for Python < 3.11).
affects: >=1.10.0
gotchaWhen using the `.. prompt::` directive, if your desired prompt string contains spaces (e.g., `(venv) $`), you cannot use positional arguments to specify it due to reStructuredText parsing limitations. The prompt will be incorrectly split.
fix
Instead of `.. prompt:: bash (venv) $`, use the `:prompts:` option: `.. prompt:: bash
   :prompts: (venv) $`
affects: *
gotchaIf you are using `sphinx-prompt` alongside other Sphinx extensions that modify or interact with code blocks (e.g., `sphinx-substitution-extensions`), the order in which extensions are loaded in `conf.py` can be important. Incorrect ordering might lead to unexpected rendering or behavior.
fix
As a general rule, ensure `sphinx_prompt` is listed *before* other extensions that might preprocess or transform code block content in your `conf.py` file to ensure `sphinx-prompt`'s directive is processed first.
affects: *
Upgrade
Version history
1.10.2latest on PyPI · released Nov 28, 2025
Audit
Dependencies
SphinxrequiredSphinx-prompt is a Sphinx extension and requires Sphinx to function.
Agent activity
5 hits · last 30 days
node
4
Resources