Thursday, March 12, 2020

Will McGugan: Progress bars with Rich

I've added progress bar support to Rich.

If you haven't seen my earlier posts on the subject, Rich is a terminal rendering framework for Python. It lets you render styled text and a whole bunch of other things (markdown, syntax, tables, tracebacks, etc.) to the terminal.

This latest addition to the lib renders progress bars with additional information such as percentage completed, time remaining, data transfer speed etc. It's highly configurable, so you can customize it to show whatever information you like. And since it's implemented as a Rich renderable, you can easily add color and formatting. Here's what it looks like:

© 2020 Will McGugan

An example of Rich progress bars

As you can see it supports multiple bars, which makes it useful for displaying progress of concurrent tasks. See downloader.py for an example which uses Rich to display progress of concurrent downloads.

Pogress bars are in Rich 0.7.0, now on Pypi.

This is the last major feature planned before a 1.0 release of Rich. Tweet @willmcgugan if you have any feedback or requests.



from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...