Skip to content

Super charge your Print statements with rich!

Look, we all do it.

It’s our guilty little secret as programmers.

Yes, we still use the print() statement for debugging out to the console.

Well now your shame can be a little prettier!

Introducing the rich library!

Install with pip or your favorite PyPi package manager.

pip install rich

And run some test output:

python -m rich

You get this:

Features

In my python files – at the top I just use it to overwrite the default print statement:

from rich import print

And now – whenever I use f-strings I get really nice colours in my output – which makes me feel a little bit better on using the print() statement as a debugging tool. I’m so naughty.

Tags:

Leave a Reply