HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
Textualize
rich
Python2020–2024
Textualize / rich

rich

Rich is a Python library for rich text and beautiful formatting in the terminal.

41Distinct people
46Mentions
3Explicit recommenders
57.8KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Rich is a Python library for rich text and beautiful formatting in the terminal.

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

They keep getting improved error messaging and this is one of my favorite features. But I'd love if we could get some real rich text. Idk if anyone else uses rich, but it has…

godelski used a recommendation phrase. 3 indexed comments match. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year46 dated mentions

Observed mentions: 2020-04-08 15:32:59 UTC to 2024-08-12 01:22:41 UTC.

0510152020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 9 mentions; 5 submissions, 4 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 16 mentions; 0 submissions, 16 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 7 mentions; 1 submissions, 6 comments20222023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 7 mentions; 1 submissions, 6 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 7 mentions; 1 submissions, 6 comments2024

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC954
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC16016
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC716
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC716
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC716

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
English readme • 简体中文 readme • 正體中文 readme • Lengua española readme • Deutsche readme • Läs på svenska • 日本語 readme • 한국어 readme • Français readme • Schwizerdütsch readme • हिन्दी readme • Português brasileiro readme • Italian readme • Русский readme • Indonesian readme • فارسی readme • Türkçe readme • Polskie readme Rich is a Python library for rich text and beautiful formatting in the terminal. The Rich API makes it easy to add color and style to terminal output. Rich can also render pretty tables, progress bars, markdown, syntax highlighted source code, tracebacks, and more — out of the box. For a video introduction to Rich see calmcode.io by @fishnets88. See what people are saying about Rich. Compatibility Rich works with Linux, macOS and Windows. True color / emoji works with new Windows Terminal, classic terminal is limited to 16 colors. Rich requires Python 3.8 or later. Rich works with Jupyter notebooks with no additional configuration required. Installing Install with pip or your favorite PyPI package manager. python -m pip install rich Run the following to test Rich output on your terminal: python -m rich Rich Print To effortlessly add rich output to your application, you can import the rich print method, which has the same signature as the builtin Python function. Try this: from rich import print print("Hello, [bold magenta]World[/bold magenta]!", ":vampire:", locals()) Rich REPL Rich can be installed in the Python REPL, so that any data structures will be pretty printed and highlighted. >>> from rich import pretty >>> pretty.install() Using the Console For more control over rich terminal content, import and construct a Console object. from rich.console import Console console = Console() The Console object has a print method which has an intentionally similar interface to the builtin print function. Here's an example of use: console.print("Hello", "World!") As you might expect, this will print "Hello World!" to the terminal. Note that unlike the builtin print function, Rich will word-wrap your text to fit within the terminal width. There are a few ways of adding color and style to your output. You can set a style for the entire output by adding a style keyword argument. Here's an example: console.print("Hello", "World!", style="bold red") The output will be something like the following: That's fine for styling a line of text at a time. For more finely grained styling, Rich renders a special markup which is similar in syntax to bbcode. Here's an example: console.print("Where there is a [bold cyan]Will[/bold cyan] there [u]is[/u] a [i]way[/i].") You can use a Console object to generate sophisticated output with minimal effort. See the Console API docs for details. Rich Inspect Rich has an inspect function which can produce a report on any Python object, such as class, instance, or builtin. >>> my_list = ["foo", "bar"] >>> from rich import inspect >>> inspect(my_list, methods=True) See the inspect docs for details. Rich Library Rich contains a number of builtin renderables you can use to create elegant output in your CLI and help you debug your code. Click the following headings for details: Log The Console object has a log() method which has a similar interface to print(), but also renders a column for the current time and the file and line which made the call. By default Rich will do syntax highlighting for Python structures and for repr strings. If you log a collection (i.e. a dict or a list) Rich will pretty print it so that it fits in the available space. Here's an example of some of these features. from rich.console import Console console = Console() test_data = [ {"jsonrpc": "2.0", "method": "sum", "params": [None, 1, 2, 4, False, True], "id": "1",}, {"jsonrpc": "2.0", "method": "notify_hello", "params": [7]}, {"jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": "2"}, ] def test_log(): enabled = False context = { "foo": "bar", } movies = ["Deadpool", "Rise of the Skywalker"] console.log("Hello from", console, "!") console.log(test_data, log_locals=True) test_log() The above produces the following output: Note the log_locals argument, which outputs a table containing the local variables where the log method was called. The log method could be used for logging to the terminal for long running applications such as servers, but is also a very nice debugging aid. Logging Handler You can also use the builtin Handler class to format and colorize output from Python's logging module. Here's an example of the output: Emoji To insert an emoji in to console output place the name between two colons. Here's an example: >>> console.print(":smiley: :vampire: :pile_of_poo: :thumbs_up: :raccoon:") 😃 🧛 💩 👍 🦝 Please use this feature wisely. Tables Rich can render flexible tables with unicode box characters. There is a large variety of formatting options for borders, styles, cell alignment etc. The animation above was generated with table_movie.py in the examples directory. Here's a simpler table example: from rich.console import Console from rich.table import Table console = Console() table = Table(show_header=True, header_style="bold magenta") table.add_column("Date", style="dim", width=12) table.add_column("Title") table.add_column("Production Budget", justify="right") table.add_column("Box Office", justify="right") table.add_row( "Dec 20, 2019", "Star Wars: The Rise of Skywalker", "$275,000,000", "$375,126,118" ) table.add_row( "May 25, 2018", "[red]Solo[/red]: A Star Wars Story", "$275,000,000", "$393,151,347", ) table.add_row( "Dec 15, 2017", "Star Wars Ep. VIII: The Last Jedi", "$262,000,000", "[bold]$1,332,539,889[/bold]", ) console.print(table) This produces the following output: Note that console markup is rendered in the same way as print() and log(). In fact, anything that is renderable by Rich may be included in the headers / rows (even other tables). The Table c
Read the full README on GitHub

What Hacker News says

46 sources
> Personally I found Textual a little weird to use, but better than ncurses. Out of curiosity, have you looked at it's sibling project "rich"? https://github.com/Textualize/rich Seems like it provides a TUI toolkit as well, and it looks a bit less weird than the approach Textual uses. Was thinking of trying it out with a side project recently, but got pulled onto some other stuff instead so haven't yet started. Nor made the choice between them. ;)
In Things I've learned building a modern TUI Framework (2022)
godelski·Oct 2, 2023Recommendation phrase
They keep getting improved error messaging and this is one of my favorite features. But I'd love if we could get some real rich text. Idk if anyone else uses rich, but it has infected all my programs now. Not just to print with colors, but because it makes debugging so much easier. Not just print(f"{var=}") but the handler[0,1]. Color is so important to these types of things and so is formatting. Plus, the progress bars are nice and have almost completely replaced tqdm for me[2]. They're just easier and prettier. [0] https://rich.readthedocs.io/en/stable/logging.html [1] Try this example: https://github.com/Textualize/rich/blob/master/examples/exce... [2] Side note: does anyone know how to get these properly working when using DDP with pytorch? I get flickering when using this and I think it is actually down to a pytorch issue and how the
Read the rest
y're handling their loggers and flushing the screen. I know pytorch doesn't want to depend on rich, but hey, pip uses rich so why shouldn't everyone?
In Python 3.12
My book Data Science at the Command Line has a chapter about this that scratches the surface and lists some resources in case you want to dive deeper [1]. I can also recommend checking out packages such as Rich [2] and Click [3], if only to get an idea of the possibilities when it comes to creating command-line tools with Python. [1] https://datascienceatthecommandline.com/2e/chapter-4-creatin... [2] https://github.com/Textualize/rich [3] https://click.palletsprojects.com/en/8.1.x/
In Bash one-liner to produce a list of HEX color codes that read like English words

Showing the 15 most recent of 46 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.