Skip to main content

sphinx-pyrepl-web

Python CI Documentation Status PyPI version PyPI

Sphinx extension to embed pyrepl-web in documentation.

Install

pip install sphinx-pyrepl-web

Usage

Add the extension to the target project's conf.py module:

extensions = [
    "sphinx_pyrepl_web",
]

Embed a REPL with the py-repl directive:

.. py-repl::

.. py-repl::
   :theme: catppuccin-latte
   :no-header:

.. py-repl::
   :src: setup.py
   :packages: numpy

.. py-repl::
   :no-header:

   >>> import math
   >>> math.sqrt(16)

Directive options

All options drive pyrepl-web's attributes:

Option Description
:theme: Color theme (catppuccin-mocha, catppuccin-latte)
:packages: Comma-separated PyPI packages, URLs, relative wheel paths, or :project:
:repl-title: Title in the REPL header
:src: Path to a Python startup script
:replay: Replay :src: with interactive prompts instead of silent load
:no-header: Hide the header bar
:no-buttons: Hide copy/clear buttons
:readonly: Disable input
:no-banner: Hide the Python version banner

Sphinx options

Enable doctest style examples conversion into pre-configured interactive REPLs with:

pyrepl_doctest_blocks:

Value Outcome
False (default) Don't convert doctest blocks
"autodoc" Convert doctest blocks from autodoc
"all" Convert all doctest blocks

pyrepl_autodoc_packages:

Value Outcome
None (default) Replay doctest input without preloading packages
:project: Build a wheel from the documented project and preload it
Wheel / PyPI names Extra packages to install, e.g. ":project:,numpy"

Optional when using :project::

Value Default Outcome
pyrepl_project_root auto-detect Project root containing pyproject.toml (relative to conf.py)
pyrepl_wheel_dir _static/wheels Directory for the built wheel, relative to conf.py

Local wheels

Unreleased package wheels can be available in the REPL by building them under Sphinx's html_static_path, or by using :project: to build automatically at doc-build time.

All options combined:

extensions = [
    "sphinx.ext.autodoc",
    "sphinx_pyrepl_web",
]

html_static_path = ["_static"]

pyrepl_doctest_blocks = "autodoc"
pyrepl_autodoc_packages = ":project:"

For a monorepo or non-default layout, point at the package root explicitly:

pyrepl_autodoc_packages = ":project:"
pyrepl_project_root = ".."

When the REPL needs the project wheel plus additional packages, combine them in one list:

pyrepl_autodoc_packages = ":project:, numpy"

The same :project: sentinel works in directive options:

.. py-repl::
   :packages: :project:, numpy

Metadata

Release files for sphinx-pyrepl-web 0.4.1

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-pyrepl-web 0.4.1
File Size Uploaded Provenance
sphinx_pyrepl_web-0.4.1.tar.gz 302.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinx-pyrepl-web 0.4.1
File Interpreter ABI Platform
sphinx_pyrepl_web-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 590.5 kB

Release files / sphinx_pyrepl_web-0.4.1.tar.gz

Download URL sphinx_pyrepl_web-0.4.1.tar.gz
Size 302.2 kB
Tags Source
SHA-256 checksum
How to use checksums
26ffae778635118203473d83467aa5122ced69d28e3dae488d557d1c879e0f84
BLAKE2b-256 checksum
How to use checksums
8df1272e7fce90b095dc851387ed53525cd65a1a26d09ec00fdba941f9113dde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / sphinx_pyrepl_web-0.4.1-py3-none-any.whl

Download URL sphinx_pyrepl_web-0.4.1-py3-none-any.whl
Size 288.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22da586383761c9771a7993b14d5c94041444d243a9b0f5b8b4ce00e8491b57b
BLAKE2b-256 checksum
How to use checksums
0f6009a437d91aac196a5d34866f37a7c9ada7093c551c91210c7eb87195fc00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Security for sphinx-pyrepl-web 0.4.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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