Skip to main content

Sphinxrun

SphinxRun 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:

import textwrap


class Wrapper:
    """Wrapper class.

    .. run::

        from example import Wrapper

        d = Wrapper()

        with open("docs/source/lorem.txt") as f:
            text = f.read()
    """

    def wrap70(self, text):
        """Wrap text to 70 columns.

        .. run::

            output = d.wrap70(text)

            sphinxrun.show(output)
        """
        return textwrap.fill(text)

renders as:

rendered doc screenshot

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

Installation

Install the package:

pip install sphinxrun
# or
uv add --dev sphinxrun

Then add the extension to the sphinx configuration:

   extensions = [
      ...
      "sphinxrun"
   ]

Documentation

The documentation is hosted at: https://sphinxrun.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

sphinx_run-0.2.2.tar.gz (94.0 kB view details)

Uploaded Source

Built Distribution

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

sphinx_run-0.2.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_run-0.2.2.tar.gz.

File metadata

  • Download URL: sphinx_run-0.2.2.tar.gz
  • Upload date:
  • Size: 94.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sphinx_run-0.2.2.tar.gz
Algorithm Hash digest
SHA256 cc23b2d909197d60c27ee54ee471409425ff57c6b3a5832b9e0663ce72fbc3c1
MD5 d377e6e62e793b5a6b8ac1c2dec4bae7
BLAKE2b-256 d90c265cd48c2b7813380d97d1a82236ec0a074f961c1924e7a1992a9630e44d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_run-0.2.2.tar.gz:

Publisher: release.yml on nlgranger/sphinxrun

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_run-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: sphinx_run-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sphinx_run-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3c8cdec1862b0b34320929dc417b78b18ba7722f165ea89e4fa37c0950e097f1
MD5 39c2b5509dd6a18e5983df48169fb059
BLAKE2b-256 27c6102ec3342f027dd3b8a639108f3a6414031e00622a43b3744473d5b79d07

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_run-0.2.2-py3-none-any.whl:

Publisher: release.yml on nlgranger/sphinxrun

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.2 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