progress1bar
A lightweight, ANSI-based progress bar for terminal output — configurable, readable, and easy to drop into loops or long-running jobs.
Installation
pip install progress1bar
Quick start
Use ProgressBar as a context manager. Set total, then increment count.
import time
from progress1bar import ProgressBar
with ProgressBar(total=250) as pb:
for _ in range(pb.total):
pb.count += 1
time.sleep(0.01) # simulate work
Showing what’s being processed (alias)
If you want the bar to show the “current item”, set alias as you go. You can also set a custom ticker.
import time
from faker import Faker
from colorama import Fore
from colorama import Style
from progress1bar import ProgressBar
kwargs = {
'total': 75,
'show_complete': False,
'clear_alias': True,
'show_duration': False,
'ticker': Style.BRIGHT + Fore.RED + chr(9644) + Style.RESET_ALL,
}
with ProgressBar(**kwargs) as pb:
for _ in range(pb.total):
pb.alias = Faker().name()
time.sleep(.08) # simulate work
pb.count += 1
Configuration
ProgressBar(
total=None,
fill=None,
regex=None,
completed_message=None,
clear_alias=False,
show_fraction=True,
show_percentage=True,
show_duration=False,
show_complete=True,
ticker=None,
use_color=True,
show_bar=True)
| Option | Type | What it does | Default |
|---|---|---|---|
total |
int |
Total units of work to complete | None |
completed_message |
str |
Message shown when complete | "Processing complete" |
show_fraction |
bool |
Show count/total |
True |
show_percentage |
bool |
Show percent complete | True |
show_duration |
bool |
Print elapsed time after completion | False |
show_complete |
bool |
Show completion message | True |
use_color |
bool |
Alias is displayed in color | True |
show_bar |
bool |
Render ticker characters (the “bar” itself) | True |
ticker |
int or str |
Unicode code point to use as the ticker character - (must be in the range 33–65532). Useful when color output is disabled. A single character or ANSI-styled string. Intended for colored or styled output. |
9632 (■) |
Number formatting (fill)
fill lets you pad the displayed total / count with leading zeros for a consistent look.
fill = {"max_total": 4, "max_completed": 4}
Regex-driven updates (regex)
If you’d rather drive the progress bar by feeding it messages (instead of setting attributes directly), you can supply regex patterns for total, count, and optionally alias. When a message matches, the captured value is applied.
import random
from faker import Faker
from progress1bar import ProgressBar
kwargs = {
"ticker": 9733, # ★
"regex": {
"total": r"^processing total of (?P<value>\d+)$",
"count": r"^processed .*$",
"alias": r"^processor is (?P<value>.*)$",
},
"use_color": False,
}
with ProgressBar(**kwargs) as pb:
pb.match(f"processor is {Faker().name()}")
total = random.randint(500, 750)
pb.match(f"processing total of {total}")
for _ in range(total):
pb.match(f"processed {Faker().name()}")
Reuse the same progress bar (reset())
If you want to reuse one ProgressBar instance across multiple runs (and keep track of repeated usage), call:
pb.reset()
More Examples
The repo includes multiple runnable examples (including variations like “no bar, just percentage/fraction”, custom tickers, regex matching, and multiple iterations with resets).
Development
Clone the repository and ensure the latest version of Docker is installed on your development server.
Build the Docker image:
docker image build \
-t progress1bar:latest .
Run the Docker container:
docker container run \
--rm \
-it \
-v $PWD:/code \
progress1bar:latest \
bash
Execute the build:
make dev
Metadata
Release files for progress1bar 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| progress1bar-1.1.1.tar.gz | 16.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| progress1bar-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.1 kB
Release files / progress1bar-1.1.1.tar.gz
| Download URL | progress1bar-1.1.1.tar.gz |
|---|---|
| Size | 16.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
711db0fde30826073159cf415fab3fcd29c276a1335faa719663e15efcde5ec3
|
|
BLAKE2b-256 checksum How to use checksums |
3402b5c59fe8c7df0a28dde7c562a96dbe211bd1997a61d558d413f00fa66209
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / progress1bar-1.1.1-py3-none-any.whl
| Download URL | progress1bar-1.1.1-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
68ca2fa59391efcdc2936dd6dc3b363eac4f5fb5effde5d25019eb6fabae568f
|
|
BLAKE2b-256 checksum How to use checksums |
357dc8cc1812927f070cd21b5f21da9754237f6feda60892c5b49ed075031e95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for progress1bar 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.