Registry / observability / pyprind

pyprind

JSON →
library2.11.3pypypi✓ verified 87d ago

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.

pip install pyprind
INSTALL
IMPORT
SIG · PYPRIND
P
pyprind
observabilitypythonv2.11.3
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.11.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ProgBar
from pyprind import ProgBar
ProgPercent
from pyprind import ProgPercent
prog_bar
import pyprind for i in pyprind.prog_bar(range(n)): pass
Generator function for progress bars, often used directly within loops.

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.")
Debug
Known issues
gotchaEnabling CPU/memory monitoring (`monitor=True`) requires the `psutil` package to be installed. Without it, a `ValueError` will be raised.
fix
Install the `psutil` package: `pip install psutil`.
affects: All versions when 'monitor=True' is used without `psutil`.
deprecatedPrior to version 2.11.0, the progress bar output would occupy two lines in the terminal. As of v2.11.0, it was consolidated to use only one line for a more compact display.
fix
Upgrade to `pyprind` version 2.11.0 or newer to use the single-line progress bar display.
affects: <2.11.0
breakingIn versions prior to 2.11.2, iterating over a completed `ProgBar` object could print unwanted new lines, causing display issues.
fix
Update to `pyprind` version 2.11.2 or later to prevent extra new lines after the progress bar completes.
affects: <2.11.2
gotchaOlder versions (pre-2.10.0) had issues with Jupyter Notebooks where the ETA was printed on new lines, disrupting the output format.
fix
Upgrade to `pyprind` version 2.10.0 or newer for improved Jupyter Notebook compatibility and display.
affects: <2.10.0
Errors
Common errors & fixes
ValueError: psutil package is required when using the `monitor` option.
Attempting to use `ProgBar(monitor=True)` or `ProgPercent(monitor=True)` without having the `psutil` library installed.
fix
Install `psutil` using pip: `pip install psutil`.
NameError: name 'pyprind' is not defined
The `pyprind` module or its classes/functions were used without being imported first.
fix
Add `import pyprind` or `from pyprind import ProgBar` (or ProgPercent) at the top of your script.
IndentationError: expected an indented block
Python relies on consistent indentation. This error often occurs in loops where `bar.update()` or similar calls are not correctly indented within the loop body.
fix
Ensure all code within a block (like a `for` loop) is indented consistently, typically with 4 spaces.
Upgrade
Version history
2.11.3latest on PyPI · released Apr 18, 2021
Audit
Dependencies
psutiloptionalOptional dependency for monitoring CPU and memory usage when 'monitor=True' is set in ProgBar or ProgPercent.
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
2
Resources
pyprind — pip install pyprind · libregistry