A prettier Python REPL with Rich
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:
>>> from rich import pretty
>>> pretty.install()
Assuming you have installed Rich of course.
Now any data will be formatted and highlighted. Here's an example:
In addition to Python data structures, any object supporting the Rich Console Protocol will be displayed. Here's an example:
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.
Just discovered Rich?
Follow @willmcgugan for updates regarding Rich.