sphinxcontrib-programoutput
Sphinx extension to include program output
What it is and what it does
sphinxcontrib-programoutput is a Sphinx extension that runs shell commands during documentation builds and inserts their output directly into the generated docs. It provides two directives: `program-output` to embed raw command output, and `command-output` to show shell session examples with prompts. This is useful for keeping documentation examples synchronized with actual program behavior—when the program's output changes, the docs update automatically on the next build.
The extension depends only on Sphinx and docutils, making it lightweight to install. It's actively maintained, supports modern Python versions (3.10 through 3.14), and runs on both CPython and PyPy. The BSD-2-Clause license places no significant restrictions on use.
Use it for:
- Keep CLI tool help text and version output in documentation automatically synchronized with the actual program.
- Generate documentation examples by running code snippets and embedding their output without manual copy-paste.
- Verify that documented command examples produce the expected output during every documentation build.
- Create shell session tutorials that show both the command and its real output without manual formatting.
- Maintain API or tool documentation where examples must reflect the current behavior of the software.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A Sphinx extension that executes arbitrary shell commands and embeds their output directly into documentation, keeping command examples synchronized with actual program behavior.
Yes. Low install friction, no security vulnerabilities, permissive license, and active maintenance. Install if you maintain Sphinx documentation for CLI tools, libraries, or examples where keeping output synchronized with actual behavior matters. The only gotcha is that command execution happens during builds, so only enable this for documentation sources you trust.
Install
sphinxcontrib-programoutput on PyPI
pip
pip install sphinxcontrib-programoutputuv
uv add sphinxcontrib-programoutputpoetry
poetry add sphinxcontrib-programoutputInstalling sphinxcontrib-programoutput
Before you install
Low friction: pure Python wheel with only Sphinx and docutils as runtime dependencies. Actively maintained with a recent release; repository is not archived and receives commits.
License in practice
BSD-2-Clause is permissive and imposes minimal restrictions on use or redistribution in most contexts.
Quickstart
pip install sphinxcontrib-programoutput
# In conf.py:
extensions = ['sphinxcontrib.programoutput']
# In your .rst file:
.. program-output:: python -V
Requires Sphinx 5.0 and Python 3.10 or later; the extension executes arbitrary commands, so only use with trusted documentation sources.
Verify before relying
- Whether command execution is sandboxed or has security restrictions beyond trusting the documentation source.
- Performance characteristics when executing many commands during a single documentation build.
- Whether output caching or incremental rebuilds are supported to avoid re-running commands.
Package facts
| License | BSD-2-Clause (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — Sphinx, docutils |
| Maintenance | actively maintained — 59 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 263,522/month — #8,355 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sphinxcontrib_programoutput-0.20-py3-none-any.whl
Keywords: sphinx, cli, command, output, program, example
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
sphinxcontrib-runcmdA Sphinx extension that executes arbitrary…
permissive · top 15,000 on PyPI
jupyter-sphinxJupyter Sphinx Extensions runs code embedded in…
unclear · top 15,000 on PyPI
sphinxcontrib-redocA Sphinx extension that embeds OpenAPI…
permissive · top 15,000 on PyPI
sphinx-promptSphinx Prompt is a Sphinx extension that…
permissive · top 5,000 on PyPI
sphinxcontrib-blockdiagA Sphinx extension that embeds block diagrams…
permissive · top 15,000 on PyPI
sphinxcontrib-typerA Sphinx extension that auto-generates…
permissive · top 15,000 on PyPI
sphinxcontrib-devhelpA Sphinx extension that generates Devhelp…
permissive · top 1,000 on PyPI
sphinxcontrib-videoA Sphinx extension that embeds HTML5 videos…
permissive · top 15,000 on PyPI
changelogA Sphinx extension that generates formatted…
permissive · top 15,000 on PyPI
sphinx-panelsA Sphinx extension that adds directives for…
permissive · top 15,000 on PyPI