rich
Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal
Terminal output in Python is stuck in the 1970s by default โ monochrome text, manual string formatting for tables, and no way to show progress without writing your own ANSI escape sequences. Rich changed the expectation of what a well-crafted CLI tool should look like.
Rich is a markup-over-print-statements system. Use rich.print() instead of print() and add [bold red]text[/bold red] markup in your strings. For structured output, create Table or Panel objects and pass them to a Console. Under the hood, Rich auto-detects whether the terminal supports colour and gracefully degrades.
Install rich
pip install rich
import richUse it when
Use Rich in any CLI tool or long-running script where you want readable output: progress bars for downloads or processing loops, syntax-highlighted code, formatted tables, structured log output, or pretty-printed Python objects for debugging.
Skip it when
Rich adds 1-2MB to your package size and a startup cost. For library code that should be output-agnostic, stick to logging. For applications deployed purely as web services with no terminal interaction, Rich adds nothing.
Ready to explore the full API?
See every class, function, and relationship in an interactive graph.