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/

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinxcontrib_run-0.3.0.tar.gz (47.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinxcontrib_run-0.3.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file sphinxcontrib_run-0.3.0.tar.gz.

File metadata

  • Download URL: sphinxcontrib_run-0.3.0.tar.gz
  • Upload date:
  • Size: 47.0 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for sphinxcontrib_run-0.3.0.tar.gz
Algorithm Hash digest
SHA256 645e725975d2dbf677e53e865382959e16da8360356957206b9803bd4e9ba0cd
MD5 119a4108766b4b3990045b0755cca004
BLAKE2b-256 54cf5e41d768cedd2188a378ccf93c3f0aeb8a7f0d0379faec97294fbecfa991

See more details on using hashes here.

File details

Details for the file sphinxcontrib_run-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: sphinxcontrib_run-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for sphinxcontrib_run-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8680857184606633f8c2bb24563c9206e566211240873896941f163896e77b35
MD5 dc7318fb44171d4053b2075a1a9c2540
BLAKE2b-256 c56c3983bcf15c2e2fc503d1b89ba7be50671e5a877880e5f26b7ffefdbad42f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page