skillfed

sphinxcontrib-programoutput

Sphinx extension to include program output

sphinxcontrib-programoutput v0.20 263.5K downloads/30d#8,355 on PyPI41
Permissive license BSD-2-Clause Active released

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-programoutput

uv

uv add sphinxcontrib-programoutput

poetry

poetry add sphinxcontrib-programoutput

Installing 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

Development Status :: 5 - Production/StableFramework :: SphinxFramework :: Sphinx :: ExtensionIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: DocumentationTopic :: Utilities

Tags

sphinx command output embeddingexecute commands in documentationkeep docs examples up to datesphinx program output directivelive command output in sphinxshell command documentationautomated example generation sphinx
sphinx-extensiondocumentation-automationcli-docs

More Utilities packages