Fastprogress
Fastprogress is a Python library providing fast and simple progress bars for Jupyter Notebooks and console applications. It features nested progress bars and plotting options, often used within the fastai ecosystem. The library is actively maintained with frequent minor releases, most recently v1.1.5, and has a cadence of several updates per year.
Warnings
- breaking Version 1.1.0 introduced a breaking change by converting to `fasthtml` for modernization. This change may affect internal behavior and can introduce a dependency on `python-fasthtml` which has been reported to cause installation issues on some platforms due to SQLite C bindings.
- gotcha If `total` is not explicitly passed to `progress_bar` or `master_bar` for an iterator of unknown length, the progress bar may not display correctly, or it might warn if the generator is empty. `fastprogress` does not auto-infer `total` for all iterables.
- gotcha In non-interactive environments (e.g., CI/CD pipelines, scripts with redirected `stdout`), the progress bars will not render visually. Only output generated by `mb.write()` will be captured.
- gotcha Users have reported `ModuleNotFoundError: No module named 'IPython'` or issues with progress bars not displaying correctly in certain Jupyter environments (e.g., VS Code Jupyter notebooks, specific `ipywidgets` configurations). This can lead to progress bars falling back to console behavior.
Install
-
pip install fastprogress
Imports
- master_bar
from fastprogress.fastprogress import master_bar
- progress_bar
from fastprogress.fastprogress import progress_bar
- ConsoleMasterBar
from fastprogress.fastprogress import ConsoleMasterBar
- ConsoleProgressBar
from fastprogress.fastprogress import ConsoleProgressBar
Quickstart
from fastprogress.fastprogress import master_bar, progress_bar
import time
mb = master_bar(range(10))
mb.write('Starting main loop...')
for i in mb:
mb.main_bar.comment = f'Processing outer item {i+1}/10'
for j in progress_bar(range(100), parent=mb):
time.sleep(0.01) # Simulate some work
mb.child.comment = f'Inner loop for item {i+1} complete'
mb.write(f'Finished outer loop iteration {i+1}.')
mb.write('All loops complete.')