A typed terminal progress bar library for Python. It handles custom widgets, clean output around prints and logs, multiple concurrent bars, unknown-length progress, and pipe-friendly CLI usage.
Install
pip install progressbar2
Quick start
import time
import progressbar
for item in progressbar.progressbar(range(100), desc='Loading'):
time.sleep(0.02)
Try it in your browser
Every example in the documentation runs live in the page. Press Run on any code block, no install required.
Progress with clean logs
"""A build log printing above a progress bar without corrupting it."""
from __future__ import annotations
import time
import progressbar
STEPS = 24
def main() -> None:
with progressbar.ProgressBar(
max_value=STEPS,
prefix='Build ',
redirect_stdout=True,
) as bar:
for step in range(STEPS):
if step in {8, 16}:
print(f'log: completed step {step}')
bar.update(step + 1)
# Longer than the bar's 0.05s update gate, so every step
# lands as a visible redraw.
time.sleep(0.1)
if __name__ == '__main__':
main()
Multiple bars
"""Two named bars progressing at different rates in one terminal."""
from __future__ import annotations
import sys
import time
import progressbar
STEPS = 24
def main() -> None:
with progressbar.MultiBar(fd=sys.stdout) as multibar:
build = multibar['build']
test = multibar['test']
build.max_value = STEPS
test.max_value = STEPS
for step in range(STEPS):
build.update(step + 1)
test.update(min(STEPS, max(0, round((step - 3) * 1.2))))
# Longer than the bars' 0.05s update gate, so every step
# lands as a visible redraw.
time.sleep(0.1)
# Reaching max_value doesn't finish a bar -- only finish() does.
# A MultiBar waits for every bar to report finished() before its
# context manager can exit, so without these calls the block
# above would hang forever on exit.
build.finish()
test.finish()
if __name__ == '__main__':
main()
Unknown length and animated bars
"""A bar for work whose total is not known up front."""
from __future__ import annotations
import time
import progressbar
def main() -> None:
with progressbar.ProgressBar(
max_value=progressbar.UnknownLength,
) as bar:
for value in range(0, 120, 10):
bar.update(value)
# Longer than the bar's 0.05s update gate, so every step
# lands as a visible redraw.
time.sleep(0.1)
if __name__ == '__main__':
main()
CLI usage
progressbar --progress --timer --eta --rate --bytes input.bin -o output.bin
Known terminal caveats
JetBrains IDEs need “Enable terminal in output console” for advanced terminal behavior such as MultiBar.
IDLE does not support terminal progress bars.
Jupyter buffers stdout; call sys.stdout.flush() when output appears late.
Project history
progressbar2 is based on the old Python progressbar package that was published on the now defunct Google Code. Since that project was completely abandoned by its developer and the developer did not respond to email, I decided to fork the package.
This package is still backwards compatible with the original progressbar package so you can use it as a drop-in replacement for existing projects.
Links
Documentation: https://progressbar-2.readthedocs.org/en/latest/
Bug reports: https://github.com/WoLpH/python-progressbar/issues
Package homepage: https://pypi.python.org/pypi/progressbar2
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file progressbar2-4.6.0.tar.gz.
File metadata
- Download URL: progressbar2-4.6.0.tar.gz
- Upload date:
- Size: 542.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe48c8955a84428af77bff2642ba47041e1b8f7c867a5b7cc94f8bc255a8f0cf
|
|
| MD5 |
28fb3387120a80ce8f18f762ae10b21b
|
|
| BLAKE2b-256 |
0c1e5bd376abe32a392e74fffd82feb42ee1472d263bd358d628af20663d0346
|
Provenance
The following attestation bundles were made for progressbar2-4.6.0.tar.gz:
Publisher:
release.yml on wolph/python-progressbar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
progressbar2-4.6.0.tar.gz -
Subject digest:
fe48c8955a84428af77bff2642ba47041e1b8f7c867a5b7cc94f8bc255a8f0cf - Sigstore transparency entry: 2458847447
- Sigstore integration time:
-
Permalink:
wolph/python-progressbar@69cc25815bb70474961811223b1c164a353fcaa9 -
Branch / Tag:
refs/heads/develop - Owner: https://github.com/wolph
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@69cc25815bb70474961811223b1c164a353fcaa9 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file progressbar2-4.6.0-py3-none-any.whl.
File metadata
- Download URL: progressbar2-4.6.0-py3-none-any.whl
- Upload date:
- Size: 104.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d78bdeb1debef92a39dd9042e0689542bd72d6e2f30b13432db371aa9d8ee4e
|
|
| MD5 |
d3ef2a6882daa8a19159982f85478377
|
|
| BLAKE2b-256 |
704cba64c450164fa4feaa9c4bb1c6445811d89d6a1995bfc58d039273b698af
|
Provenance
The following attestation bundles were made for progressbar2-4.6.0-py3-none-any.whl:
Publisher:
release.yml on wolph/python-progressbar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
progressbar2-4.6.0-py3-none-any.whl -
Subject digest:
2d78bdeb1debef92a39dd9042e0689542bd72d6e2f30b13432db371aa9d8ee4e - Sigstore transparency entry: 2458847483
- Sigstore integration time:
-
Permalink:
wolph/python-progressbar@69cc25815bb70474961811223b1c164a353fcaa9 -
Branch / Tag:
refs/heads/develop - Owner: https://github.com/wolph
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@69cc25815bb70474961811223b1c164a353fcaa9 -
Trigger Event:
workflow_dispatch
-
Statement type: