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/

Metadata

Release files for sphinx-run 0.2.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-run 0.2.2
File Size Uploaded
sphinx_run-0.2.2.tar.gz 94.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinx-run 0.2.2
File Interpreter ABI Platform
sphinx_run-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 98.6 kB

Release files / sphinx_run-0.2.2.tar.gz

Download URL sphinx_run-0.2.2.tar.gz
Size 94.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cc23b2d909197d60c27ee54ee471409425ff57c6b3a5832b9e0663ce72fbc3c1
BLAKE2b-256 checksum
How to use checksums
d90c265cd48c2b7813380d97d1a82236ec0a074f961c1924e7a1992a9630e44d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 20, 2025.

Transparency log

Release files / sphinx_run-0.2.2-py3-none-any.whl

Download URL sphinx_run-0.2.2-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c8cdec1862b0b34320929dc417b78b18ba7722f165ea89e4fa37c0950e097f1
BLAKE2b-256 checksum
How to use checksums
27c6102ec3342f027dd3b8a639108f3a6414031e00622a43b3744473d5b79d07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 20, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.2 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