A terminal progress printing utility
Project description
PyProgress
General Use
A simple interface for terminal based progress updates
Begin by creating an instance with the starting and ending value
import os
files = os.listdir('.')
bar = ProgressBar(0, len(files))
for file in files:
bar.iterbegin('Processing file: {}'.format(file))
process(file)
bar.iterdone()
bar.done()
Manually call ProgressBar.iterbegin([message])
before an iteration starts
and call ProgressBar.iterend()
when it completes or ProgressBar.iterfail()
if it fails
When all items complete use ProgressBar.done()
to print a summary
Alternative Use – Context Manager
ProgressBar instances can also be used as context managers
use a with statement on every iteration
import os
files = os.listdir('.')
bar = ProgressBar(0, len(files), supress_exc=True)
for file in files:
with bar:
process(file)
bar.done()
Using the supress_exc=True
argument will report statistic for failures
from raised exceptions but not raise the exception itself
This is not necessary to use bar as a Context Manager but you must use it as a Context Manager to get the exception suppressing behavior
Project details
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
File details
Details for the file pyprogress_elunico-0.1.6.tar.gz
.
File metadata
- Download URL: pyprogress_elunico-0.1.6.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65ba6b0a01f3db3cd88827ccad75cc3670d9c3cfd44815d1f2b33b054ba5a2a9 |
|
MD5 | d9936f8449aba605cefbf25cbff59b00 |
|
BLAKE2b-256 | 594ea765be7f152e44f1daa79b8a77ad74059abbb595f20c13e5d4cfd09f77e7 |
File details
Details for the file pyprogress_elunico-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: pyprogress_elunico-0.1.6-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73acf3bf35b19afd532b90f7f6668c8fa06bff92729d95b5988926c7b9367ecc |
|
MD5 | 980237903eb6fab42aa3abc0a7c33faf |
|
BLAKE2b-256 | 01bdbd1049b79de483267795512ed1184fc036135a2b7768b0a26bfca95c62f6 |