PyPrind (Python Progress Indicator)

2.11.3 · maintenance · verified Thu Apr 16

PyPrind is a Python module that provides simple yet effective progress bar and percentage indicator utilities. It allows developers to visualize the progress of iterative computations, which is particularly useful for long-running processes or when handling large datasets. The library's current version is 2.11.3, with its last release in April 2021, indicating a slow release cadence and a current status of maintenance.

Common errors

Warnings

Install

Imports

Quickstart

This example demonstrates how to create a progress bar using the `ProgBar` class and the `prog_bar` generator function. It initializes a progress bar with a specified number of iterations and updates it within a loop. An optional section shows how to use the `monitor=True` feature, which requires the `psutil` package.

import time
import pyprind

n = 10000000 # Number of iterations

# Using ProgBar class
bar = pyprind.ProgBar(n, title='Processing Data')
for i in range(n):
    # Simulate some computation
    # time.sleep(0.000001) # Uncomment to slow down and see progress
    bar.update()
print(bar)

print("\nAlternatively, using the generator function:")
# Using prog_bar generator function
for i in pyprind.prog_bar(range(n), title='Another Task'):
    # Simulate some computation
    pass # time.sleep(0.000001)

# Example with monitor=True (requires psutil)
# try:
#     bar_monitor = pyprind.ProgBar(100, monitor=True, title='Monitoring System')
#     for i in range(100):
#         time.sleep(0.1)
#         bar_monitor.update()
#     print(bar_monitor)
# except ValueError as e:
#     print(f"Warning: {e}. Install psutil (pip install psutil) for monitoring.")

view raw JSON →