Skip to main content

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.

python-progressbar test status coverage status

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

progressbar2 showing clean progress output with 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

multiple progress bars updating together
"""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

unknown length progress with an animated marker
"""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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

progressbar2-4.6.0.tar.gz (542.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

progressbar2-4.6.0-py3-none-any.whl (104.2 kB view details)

Uploaded Python 3

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

Hashes for progressbar2-4.6.0.tar.gz
Algorithm Hash digest
SHA256 fe48c8955a84428af77bff2642ba47041e1b8f7c867a5b7cc94f8bc255a8f0cf
MD5 28fb3387120a80ce8f18f762ae10b21b
BLAKE2b-256 0c1e5bd376abe32a392e74fffd82feb42ee1472d263bd358d628af20663d0346

See more details on using hashes here.

Provenance

The following attestation bundles were made for progressbar2-4.6.0.tar.gz:

Publisher: release.yml on wolph/python-progressbar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for progressbar2-4.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d78bdeb1debef92a39dd9042e0689542bd72d6e2f30b13432db371aa9d8ee4e
MD5 d3ef2a6882daa8a19159982f85478377
BLAKE2b-256 704cba64c450164fa4feaa9c4bb1c6445811d89d6a1995bfc58d039273b698af

See more details on using hashes here.

Provenance

The following attestation bundles were made for progressbar2-4.6.0-py3-none-any.whl:

Publisher: release.yml on wolph/python-progressbar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page