Skip to main content

sphinxcontrib-run

sphinxcontrib-run registers a new .. run:: directive to execute code dynamically while building a sphinx documentation. It can be used to generate documentation artifacts such as figures or to insert dynamic content.

Example:

"""
.. run::

    from example import square_text_50

    lorem = (
        "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
        + " Pellentesque faucibus vestibulum est id consequat."
        + " Cras sed enim sed ex maximus blandit."
    )
"""


def square_text_50(text):
    """Wrap text to 40 columns.

    .. run::

        print("::")
        print("")
        for line in square_text_50(lorem):
            print("    " + line)
        print("")
    """
    for i in range(0, len(text), 50):
        yield text[i : i + 50]

renders as:

rendered doc screenshot

Note: The environement persists across calls within the scope of a document.

Installation

Install the package:

pip install sphinxcontrib-run

Then add the extension to the sphinx configuration:

   extensions = [
      ...
      "sphinxcontrib.run"
   ]

Documentation

The documentation is hosted at: https://sphinxcontrib-run.readthedocs.io/en/latest/

Metadata

Release files for sphinxcontrib-run 0.3.0

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

Source distribution (sdist)

Source distribution for sphinxcontrib-run 0.3.0
File Size Uploaded
sphinxcontrib_run-0.3.0.tar.gz 47.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinxcontrib-run 0.3.0
File Interpreter ABI Platform
sphinxcontrib_run-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.9 kB

Release files / sphinxcontrib_run-0.3.0.tar.gz

Download URL sphinxcontrib_run-0.3.0.tar.gz
Size 47.0 kB
Tags Source
SHA-256 checksum
How to use checksums
645e725975d2dbf677e53e865382959e16da8360356957206b9803bd4e9ba0cd
BLAKE2b-256 checksum
How to use checksums
54cf5e41d768cedd2188a378ccf93c3f0aeb8a7f0d0379faec97294fbecfa991
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / sphinxcontrib_run-0.3.0-py3-none-any.whl

Download URL sphinxcontrib_run-0.3.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8680857184606633f8c2bb24563c9206e566211240873896941f163896e77b35
BLAKE2b-256 checksum
How to use checksums
c56c3983bcf15c2e2fc503d1b89ba7be50671e5a877880e5f26b7ffefdbad42f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

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