Awesome progress bar
It's a progress bar for the terminal. But why it is awesome?
- It has thread mode. This way progress bar can run in the parallel.
- It's animated with ASCII characters.
- It also measures elapsed time.
- It's user-friendly and customizable.
Why does progress bar need to be run in the parallel mode?
The bar should be updated when it is time to. Imagine we are doing something in the for
loop and each iteration we update its state. But each iteration can take different amount
of time. And each iteration can be longer than 1 minute. And without threads the animation
would have non-constant amount of FPS.
How to use
Initialization
Parameters:
| total | Amount of iterations |
| prefix | A short message before the progress bar. Default is 'Progress' |
| suffix | A short message after the progress bar. Default is '' |
| fill | A character that will be used as progress bar filler. Default is '=' |
| bar_length | The length of the whole string (including prefix, spinner, progress bar, percents and suffix). Default is equal to the minimum between terminal's width and 100 |
| update_period | The duration of pause between iterations in seconds. Default is 0.1. Works
only if use_thread is True |
| use_time | If True there will be an information about elapsed time in the center of
the progress bar written in time_format format. Default is True |
| time_format | String, that should include 'hh', 'mm' or/and 'ss'.
'hh' will be replaced with amount of elapsed hours, 'mm' - minutes,
'ss' - seconds. Default is 'mm:ss' |
| use_thread | If True ProgressBar will create extra thread. Default is True |
| spinner_type | One of ['sb', 'db', 's']. With 'sb' progress bar will print
spinner consisting of 1 Braille pattern. 'db' - 2 Braille patterns.
's' - a slash. Default is 'sb' |
| use_spinner | If True the spinner will be shown. Default is True |
| last_char | Something, that will be printed after the progress is done. Default is '\n' |
| use_eta | If True the information about approximate remaining time will be printed.
Default is False |
| eta_format | The format of ETA. Similar to the time_format. Default is equal to the time_format |
Methods
| iter(append='') |
Used for tracking the progress.
|
| get_time_passed (return_str=True) |
Returns the time spent. If the progress is done returns bar's operating time. If not - returns the time elapsed from the progress start. Parameters:
|
| stop() |
Stops the bar in the thread mode.
If the bar doesn't call the |
| wait() |
Blocks the program until bar is dead.
The bar updates every update_period seconds in the thread mode. Hence, there can
be a small delay between last calling |
* stop() and wait() are needed only in the thread mode.
Examples
from awesome_progress_bar import ProgressBar
import time
total = 133
bar = ProgressBar(total, bar_length=50)
try:
for x in range(total):
time.sleep(0.1)
bar.iter(' Appended')
except:
bar.stop()
bar.wait()
print('Bar is done')
# Progress: |=========== 00:15 ============| 100.00% Appended
# Bar is done
from awesome_progress_bar import ProgressBar
bar = ProgressBar(100, prefix='Prefix', suffix='Suffix', use_eta=True, bar_length=70)
# Prefix: в ‡ |==> 00:00/00:14 | 5.26% Suffix
bar = ProgressBar(100, fill='#', use_time=False, bar_length=50, use_spinner=False)
# Progress: |##########> | 33.83%
bar = ProgressBar(100, time_format='hhh mmmin sss', bar_length=70, spinner_type='s')
# Progress: - |=======> 00h 00min 02s | 16.54%
bar = ProgressBar(100, bar_length=70, spinner_type='db')
# Progress: вў€вЎ± |===========> 00:04 | 24.81%
See more here.
Feel free to suggest ideas to improve this package in the GitHub's Issues section.
Metadata
Release files for awesome-progress-bar 1.7.2
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 | Actions |
|---|---|---|---|---|
| awesome-progress-bar-1.7.2.tar.gz | 18.4 kB | Without provenance | Details for awesome-progress-bar-1.7.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| awesome_progress_bar-1.7.2-py3-none-any.whl | Python 3 | none | any | Details for awesome_progress_bar-1.7.2-py3-none-any.whl |
Total release size: 38.9 kB
Release files / awesome-progress-bar-1.7.2.tar.gz
| Download URL | awesome-progress-bar-1.7.2.tar.gz |
|---|---|
| Size | 18.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cccb126830b6a5d503d98e56c4526ee3d0d01f7a25fa55b07cb99ceded24fd41
|
|
BLAKE2b-256 checksum How to use checksums |
afebe485a7a52c87bd05bd8f45a1e916127b364f25dca999d5fb67e4bf8552d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
|
Release files / awesome_progress_bar-1.7.2-py3-none-any.whl
| Download URL | awesome_progress_bar-1.7.2-py3-none-any.whl |
|---|---|
| Size | 20.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7efda2b212be0a73f11e7272fe794b908b8ab5c7c106a64ccde32ad781f3feba
|
|
BLAKE2b-256 checksum How to use checksums |
4db0c27695e5773d63e2fe19bd60165af110a3b2c988958e568166b8a2419866
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
|
Security for awesome-progress-bar 1.7.2
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.