Skip to main content

Sphinx Prompt

Initialize

In conf.py add extensions += ['sphinx_prompt'].

Syntax

A default prompt can be created using a prompt directive:

.. prompt::

   <statements>

The prompt can be further customized in one of two ways:

  • Using positional arguments:

    .. prompt:: [<language> [<prompts> [<modifiers>]]]
    
        <statements>
    
  • Using options:

    .. prompt::
        :language: <language>
        :prompts: <prompts>
        :modifiers: <modifiers>
    
       <statements>
    

While these constructs generate the same output, the positional arguments cannot be used if you want to use a prompt that contains spaces. This is a limitation of reStructuredText.

Positional arguments can be mixed with options if they don't overlap (so if you pass prompts using options, you can only pass the language using positional arguments):

.. prompt:: bash
    :prompts: (cool_project) $

   python3 -m pip install --upgrade sphinx-prompt

Language

Supported language:

  • text (no pigments, default)
  • bash
  • batch
  • powershell
  • python
  • scala

Prompt(s)

If modifier is auto, a comma-separated list of prompts to find in the statements.

Else the prompt to add on each statements, for Python and Bash language the end \ is supported.

Defaults to empty, except for the shell languages listed below:

  • bash - $
  • batch - C:\>
  • powershell - PS C:\>

Examples

See: http://sbrunner.github.io/sphinx-prompt/

Run tests and prospector

python3 -m pip install --user --upgrade poetry
poetry install
poetry run pytest
poetry run prospector

The code should be formatted with black add isort.

Create new release

git tag <version>
git push origin <version>

Contributing

Install the pre-commit hooks:

pip install pre-commit
pre-commit install --allow-missing-config

Release files for sphinx-prompt 1.10.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinx-prompt 1.10.2
File Size Uploaded
sphinx_prompt-1.10.2.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinx-prompt 1.10.2
File Interpreter ABI Platform
sphinx_prompt-1.10.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / sphinx_prompt-1.10.2.tar.gz

Download URL sphinx_prompt-1.10.2.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
47b592ba75caebd044b0eddf7a5a1b6e0aef6df587b034377cd101a999b686ba
BLAKE2b-256 checksum
How to use checksums
d0a391293c0e0f0b76d0697ba7a41541929ca3f5457671d008bd84a9bde17e21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / sphinx_prompt-1.10.2-py3-none-any.whl

Download URL sphinx_prompt-1.10.2-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6594337962c4b1498602e6984634bed4a0dc7955852e3cfc255eb0af766ed859
BLAKE2b-256 checksum
How to use checksums
a9f444ce4d0179fb4e9cfe181a8aa281bba23e40158a609fb3680774529acaaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release history Release notifications | RSS feed

This release

1.10.2 This release

2 release files

1.10.1

2 release files

1.10.0

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

1 release file

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page