Skip to main content

sphinx-pyrepl-web

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 or relative wheel paths
: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
Wheel path / PyPI names Install the package and import the documented object before replay

Local wheels

Unreleased package wheels can be available in the REPL by building them under Sphinx's html_static_path.

All options combined:

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

html_static_path = ["_static"]

pyrepl_doctest_blocks = "autodoc"
pyrepl_autodoc_packages = "_static/wheels/my_package-1.0.0-py3-none-any.whl"

Download files

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

Source Distribution

sphinx_pyrepl_web-0.3.0.tar.gz (295.2 kB view details)

Uploaded Source

Built Distribution

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

sphinx_pyrepl_web-0.3.0-py3-none-any.whl (283.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sphinx_pyrepl_web-0.3.0.tar.gz
  • Upload date:
  • Size: 295.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for sphinx_pyrepl_web-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cb850fcbcaa64f7a59520c668e49ed4a38828735c97d2a3e5217c0e231860f1d
MD5 7ad037be2394c7b7f3fc493c884568c2
BLAKE2b-256 6c494d663cac461d9e57d253f88ce859c42afd3c4babf83cf578bc606cbf24f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sphinx_pyrepl_web-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56fb267c8ca5fb51d774e89bd2dbfcc0d33bf309fe4c781f3476d0e9a11895c0
MD5 2922b88cf5c2b5cc9f2adb830b751d0f
BLAKE2b-256 2d8af0f9651e9127a2cc687784718b33e4c40ee54bd2e652ec525cd2d7344cc9

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.1

2 files

0.4.0

2 files

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 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