Skip to main content

richterm

CI docs pypi version Changelog Ruff License

richterm turns arbitrary terminal commands into Rich-rendered SVG images. Run it from the command line or embed live captures in Sphinx documentation with a dedicated directive.

This project was created and is still maintained with python-package-copier-template.

Quick start

Run the CLI without installing anything permanently:

uvx richterm

To install the tool permanently:

uv tool install richterm

Each invocation writes an SVG named rich_term_<TIMESTAMP>.svg (or the file passed with -o/--output) and echoes the command output back to the terminal.

To keep colours vibrant even in non-interactive captures, richterm sets friendly defaults: TERM=xterm-256color (when missing) plus FORCE_COLOR=1, CLICOLOR_FORCE=1, PY_COLORS=1, and TTY_COMPATIBLE=1 unless you override them. Opt out with RICHTERM_DISABLE_COLOR_HINT=1 or by exporting NO_COLOR; if your CI sets NO_COLOR but you still want colour, explicitly set FORCE_COLOR=1.

Command-line usage

usage: richterm [-h|--hide-command] [-o PATH] [--prompt STR] [--shown-command STR] <command...>
  • --hide-command hides the prompt and command line in the transcript.
  • --prompt accepts Rich markup and defaults to $.
  • -o/--output selects the SVG path; otherwise a timestamped filename is generated.
  • --shown-command lets you display a different command than the one executed (handy when a fixture command would distract readers). Cannot be combined with --hide-command.

Examples:

richterm ls -la
richterm --prompt "[bold blue]λ" -o docs/_static/listing.svg git status --short
richterm --hide-command python -c "print('\033[31merror\033[0m')"
richterm --shown-command "pytest -q" python -c "print('actually running something else')"

Sphinx integration

richterm optionally works as a Sphinx extension. Install the extras and enable it in your conf.py:

uv add richterm[sphinx]
# docs/conf.py
extensions = [
    "myst_parser",
    "sphinxcontrib.mermaid",
    "richterm.sphinxext",
]
richterm_prompt = "[bold]$"
richterm_hide_command = False

Then use the directive in MyST:

```{richterm} python -m rich --force-terminal --no-color-system example
```

Or in reStructuredText:

.. richterm:: python -m rich --force-terminal --no-color-system example

The directive executes the command during the build, embeds the SVG directly in HTML output, and falls back to a literal block for non-HTML builders. The :prompt: and :hide-command: options mirror the CLI flags. A nonzero exit fails the build by default; add :allow-failure: to render the captured output and continue.

Development

Tests depend on the Sphinx extras:

uv run --extra sphinx pytest

Or directly make test

Build the documentation, which exercises the directive itself:

make docs

Metadata

Release files for richterm 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for richterm 0.4.0
File Size Uploaded Provenance Actions
richterm-0.4.0.tar.gz 10.2 kB With provenance Details for richterm-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for richterm 0.4.0
File Interpreter ABI Platform Actions
richterm-0.4.0-py3-none-any.whl Python 3 none any Details for richterm-0.4.0-py3-none-any.whl

Total release size: 20.8 kB

Release files / richterm-0.4.0.tar.gz

Download URL richterm-0.4.0.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e323da3fb512edbf91880505925e2e6e24bb7ec0884a5eb2b9b3b0de22cc356b
BLAKE2b-256 checksum
How to use checksums
3e01c02e55868fe03dc3e64e79fcac7d4f282d9a9e2d6e392693c707e6168ffb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 Oct 21, 2026.

Transparency log

Release files / richterm-0.4.0-py3-none-any.whl

Download URL richterm-0.4.0-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ceaadb0c5069aa016a5d31afee5ab27fc49b181955468f82da509fcfcfef73a1
BLAKE2b-256 checksum
How to use checksums
d5be348b6ca2a49a5a56c8f94a11bade840672ab4055df0eec17deab1269caeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 Oct 21, 2026.

Transparency log

Security for richterm 0.4.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for richterm-0.4.0.tar.gz

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 Oct 21, 2026.

Transparency log

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