Posts in August, 2020

Rich 5.1.0 adds the ability to integrate highlighted pretty printing with the Python REPL. Here's how you would use it in a session:

Assuming you have installed Rich of course.

Now any data will be formatted and highlighted. Here's an example:

Rich will expand builtin containers until the output fits in to the width of the screen.

In addition to Python data structures, any object supporting the Rich Console Protocol will be displayed. Here's an example:

The Panel class is one of a number of renderables in Rich.

The formatting and highlighting really comes in to its own when you're working with JSON data. The following video shows an example of pretty printing data queried from a web service. In this instance, its cat facts.

Follow @willmcgugan for updates regarding Rich.