rich
A Python library for rendering rich text, tables, progress bars, and syntax-highlighted code in the terminal.
Repository Health
Technical Analysis
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
Consoleobject and drop-inprint()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 43 apps in this directory
Agent Lightning
AI Development
A Microsoft-built training framework that optimizes AI agents with reinforcement learning, automatic prompt optimization, or supervised fine-tuning — with near-zero code changes to your existing agent, in any framework.
Agno
Devops · AI Development · Automation
Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.
Airbyte
Developer Tools · Data Engineering
Open-source ELT platform with 600+ connectors for moving data from any source to warehouses, lakes, and AI agents.
Apache Airflow
Data Engineering
Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.
ArchiveBox
Bookmarks Archiving
Self-hosted web archiving that saves HTML, PDFs, screenshots, media, and code in open formats you own forever
argilla
AI Development · Data Engineering
Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.
AutoGen
AI Development · Automation
Build autonomous and human-in-the-loop multi-agent AI systems with a layered, event-driven Python and .NET framework pioneered at Microsoft Research.
AutoGPT
Automation · Productivity · AI Assistants
Build, deploy, and run autonomous AI agents that automate complex multi-step workflows using a visual block-based graph editor.
Banana Slides
AI Design Tools · Productivity
AI-native PPT generator with Vibe editing, multi-LLM support, and fully editable PPTX export