Skip to main content

Rich Toolkit

This is a very opinionated set of components for building CLI applications. It is based on Rich

Installation

pip install rich-toolkit

Example usage

Rich toolkit comes with an App class, this is used to give a consistent style to your CLI application, it can be used as a context manager, like so:

TODO: new example

Output encoding

The consoles created by Rich Toolkit respect the output stream's encoding. Characters that the stream can encode are printed unchanged. Unsupported characters in human-readable content are replaced with ?: for example, café 🚀 becomes café ? on a CP1252 stream. Stored input and menu values are never changed by this display conversion.

Built-in menu markers and style decorations use ASCII alternatives when needed. Custom styles can use self.symbol("●", fallback=">") for decorations and self.display_text(value) when measuring or positioning arbitrary text. Rich Text is converted before wrapping, with table cells and common layout wrappers also prepared before measurement. Styles and links are preserved. Unsupported characters in hyperlink targets are percent-encoded as UTF-8, preserving the destination. Custom renderables emitting raw Segment objects also get a final encoding fallback; they should prepare text before computing their own layout to account for the changed character widths.

JSON output always uses ASCII with JSON escapes for Unicode characters, including on UTF-8 streams. Decoding the JSON restores the original values.

The library does not reconfigure sys.stdout or sys.stderr. Human-readable encoding fallbacks apply to the toolkit's default consoles; a custom replacement console is responsible for its own encoding policy.

Running tests with an encoding

Run the entire suite with a selected output encoding:

PYTHONIOENCODING=cp1252:strict uv run pytest

The suite supports utf-8 (the default), ascii, cp1252, and gbk. Its capture streams and in-memory output streams use the selected encoding with strict errors, including when tests call capsys.readouterr(). Individual encoding regression tests still use their explicitly selected streams.

GitHub Actions runs the full suite in UTF-8 across the Python/Pydantic matrix, plus ASCII, CP1252, and GBK runs on Python 3.14 with Pydantic v2.

Metadata

Release files for rich-toolkit 0.20.5

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

Source distribution (sdist)

Source distribution for rich-toolkit 0.20.5
File Size Uploaded
rich_toolkit-0.20.5.tar.gz 213.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rich-toolkit 0.20.5
File Interpreter ABI Platform
rich_toolkit-0.20.5-py3-none-any.whl Python 3 none any Details

Total release size: 252.6 kB

Release files / rich_toolkit-0.20.5.tar.gz

Download URL rich_toolkit-0.20.5.tar.gz
Size 213.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0c9e1c414ffb0720be26285d472e263d1e704b71d31a7e13274b9996db4969e1
BLAKE2b-256 checksum
How to use checksums
9f1cf134352beb393cc17e6241ecf0bf4dd41a6759e2e3971a69a6ad185b87a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","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}

Release files / rich_toolkit-0.20.5-py3-none-any.whl

Download URL rich_toolkit-0.20.5-py3-none-any.whl
Size 39.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e21fd616db9c0539d3c50f3433fb1173db95c19d3cbf215615e224182fad6c18
BLAKE2b-256 checksum
How to use checksums
6a5fee8c39750ed9837f54021a8a0eb96f971cd788c1a7d40931867d6d0518bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","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}

Release history Release notifications | RSS feed

This release

0.20.5 This release

2 release files

0.20.3

2 release files

0.20.2

2 release files

0.19.9

2 release files

0.19.8

2 release files

0.19.7

2 release files

0.19.6

2 release files

0.19.5

2 release files

0.19.4

2 release files

0.19.3

2 release files

0.19.2

2 release files

0.19.1

2 release files

0.17.2

2 release files

0.17.1

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.9

2 release files

0.14.8

2 release files

0.14.7

2 release files

0.14.6

2 release files

0.14.4

2 release files

0.14.3

2 release files

0.14.2

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.13.2

2 release files

0.13.1

2 release files

0.13.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release 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