rich

A Python library for rendering rich text, tables, progress bars, and syntax-highlighted code in the terminal.

Library
PyPI
v15.0.0
57,620 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
56 /100 Fair
Development Activity 12
Maintenance 48
Community 64
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
89 /100 Excellent
Architecture 85
Code Quality 88
Innovation 92
Learning Curve 90

Rich turns plain terminal output into readable, well-formatted text with almost no extra code. A single import replaces the built-in print function with one that understands colors, styles, and a compact BBCode-like markup, while a Console object gives finer control over layout, word-wrapping, and terminal width detection.

Beyond text styling, Rich ships a full set of renderables: tables that auto-size to their content, progress bars that track multiple concurrent tasks, live-updating displays that redraw in place, Markdown rendering, and Pygments-backed syntax highlighting for code blocks and tracebacks. Any object can plug into this system by implementing the __rich_console__ protocol, so third-party libraries can render themselves through Rich without Rich needing to know about them in advance.

It also works outside the terminal: pretty.install() upgrades the Python REPL to auto-format data structures, and output can be exported to HTML or SVG for embedding elsewhere, including Jupyter notebooks.

What You Get

  • A Console object and drop-in print() replacement with markup-based colors and styles
  • Renderables for tables, panels, columns, trees, and progress bars that auto-size to terminal width
  • Live-updating displays (Live, Progress) that redraw in place without flicker
  • Pygments-backed syntax highlighting for code blocks and exception tracebacks
  • Markdown rendering and pretty-printing of Python data structures (pretty.install())
  • HTML and SVG export of rendered output for embedding outside the terminal

Common Use Cases

  • Formatting CLI tool output with colors, tables, and progress indicators
  • Rendering readable, syntax-highlighted tracebacks for easier debugging
  • Building live dashboards or progress displays for long-running scripts
  • Pretty-printing complex data structures during interactive REPL sessions
  • Rendering Markdown or code snippets directly in terminal-based tools

Under The Hood

Architecture

Rich centers on a Console object (rich/console.py, ~2,700 lines) that orchestrates rendering: any object implementing the renderable protocol (__rich_console__ and __rich_measure__, defined in rich/protocol.py and rich/abc.py) can be handed to console.print() and rendered without Console needing prior knowledge of its type. Renderables (Table, Panel, Markdown, Syntax, Progress, Layout, and others, each its own module) yield a stream of Segment objects — the atomic unit pairing text with a Style — which Console then converts into ANSI control codes via control.py, with a separate ctypes-based path through _win32_console.py/_windows_renderer.py for older Windows terminals. Live and Progress build on this same Console/Segment pipeline to redraw regions in place. This protocol-based, duck-typed design means the core abstraction to change carefully is the renderable protocol itself — nearly every built-in renderable and any third-party integration depends on it.

Tech Stack

Rich targets Python 3.9+ and is built/packaged with Poetry (poetry-core backend, pyproject.toml). Its only required runtime dependencies are pygments (>=2.13) for syntax highlighting and markdown-it-py (>=2.2.0) for Markdown rendering, with ipywidgets as an optional extra for Jupyter integration. There is no web or database layer — it’s a pure terminal-rendering library. Development tooling includes pytest for testing, black and isort (black profile) for formatting, mypy in strict mode for type checking, and pre-commit hooks (pycln, codespell, and standard hygiene checks) enforced via GitHub Actions CI (pythonpackage.yml, codeql.yml for security scanning).

Code Quality

The repo ships a py.typed marker and enforces mypy in strict mode with additional error codes enabled (ignore-without-code, redundant-expr, truthy-bool), indicating a genuine commitment to type safety rather than a token typed export. Test coverage is extensive: 68 files under tests/, covering individual renderables (tables, panels, columns, bars, colors, control sequences) with a shared conftest.py and dedicated SVG/card rendering test helpers. Formatting and import order are enforced via black and isort through pre-commit, and a custom errors.py module defines a clear exception hierarchy rather than relying on generic exceptions. CI runs the test suite plus CodeQL security scanning on every change.

API Design Rich’s headline design choice is making the common case a near drop-in replacement for the built-in print — from rich import print requires no other setup to get colored, word-wrapped output. Styling is expressed through a compact BBCode-like markup ([bold red]...[/]) rather than manual ANSI escape codes, and more advanced usage flows naturally through a single Console object rather than a scattered API surface. Documentation is thorough (readthedocs reference plus READMEs translated into 17 languages), and the renderable protocol keeps the public API small while still letting advanced users define fully custom renderables. The result is very low boilerplate for basic use and a consistent mental model as usage grows more advanced.

Used by 47 apps in this directory

Python
84%
MIT

LiteLLM

AI Development · Developer Tools

61,933

Open source AI gateway and Python SDK that gives you one OpenAI-compatible interface to call 100+ LLM providers, with built-in routing, cost tracking, guardrails, and virtual keys.

View details
93
Repo Health
81
Technical
69
Dependency
Built with
Python 84%
TypeScript 11%
Updated 6 days ago
Python
62%
Apache 2.0

marimo

Data Engineering · Developer Tools

23,309

A reactive Python notebook that eliminates hidden state, runs reproducibly, and deploys as a web app or script — stored as pure Python, built for the AI era.

View details
90
Repo Health
91
Technical
65
Dependency
Built with
Python 62%
TypeScript 37%
Updated 6 days ago
TypeScript
84%
Apache 2.0

nao

AI Development · Analytics

1,949

Build and deploy an open-source analytics agent that understands your data warehouse and answers business questions in plain English.

View details
85
Repo Health
76
Technical
67
Dependency
Built with
TypeScript 84%
Python 15%
Updated 6 days ago
TypeScript
60%
MIT

oh-my-claudecode

AI Agents

40,215

Multi-agent orchestration for Claude Code with zero learning curve — install as a plugin or npm CLI and coordinate parallel Claude Code agents through pre-built workflows instead of managing them by hand.

View details
85
Repo Health
70
Technical
73
Dependency
Built with
TypeScript 60%
JavaScript 39%
Updated 6 days ago
Ruby
63%
MIT

OnetimeSecret

Security

2,970

Generate self-destructing single-use links to share passwords and sensitive data without leaving traces in inboxes or chat logs.

View details
92
Repo Health
81
Technical
72
Dependency
Built with
Ruby 63%
TypeScript 24%
Updated 6 days ago
Python
100%
Other

OpenBB

Analytics · Databases · Invoicing Finance

74,601

The AI Workspace for Finance: Connect Data, Run AI Agents, Build Analytics

View details
80
Repo Health
80
Technical
65
Dependency
Built with
Python 100%
Updated 1 weeks ago
Python
74%
Apache 2.0

OpenKB

Knowledge Management

4,804

An open-source CLI that compiles raw documents into a structured, interlinked wiki-style knowledge base using LLMs — powered by vectorless, reasoning-based retrieval (PageIndex) instead of a vector database.

View details
48
Repo Health
72
Technical
77
Dependency
Built with
Python 74%
TypeScript 23%
Updated 3 months ago
Python
39%
Apache 2.0

OpenSandbox

Developer Tools · Security

16,116

Secure, fast, and extensible sandbox runtime for AI agents with multi-language SDKs and Docker/Kubernetes runtimes.

View details
85
Repo Health
81
Technical
70
Dependency
Built with
Python 39%
Go 36%
Updated 6 days ago
Python
73%
AGPL 3.0

OpenViking

AI Development · AI Memory · Databases

40,705

An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.

View details
85
Repo Health
75
Technical
64
Dependency
Built with
Python 73%
TypeScript 12%
Rust 11%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers