Light progress reporting tool for Python
Project description
This is progress reporting tool for Python
n = 42
with ProgressBar(n) as progress_bar:
for item in range(n):
sleep(0.01)
progress_bar.forward()
# [-..............................] 1% (1/42)
# [===============-...............] 50% (21/42)
# [===============================] 100% (42/42)
Examples
Pattern 1
Call start forward and finish yourself.
from time import sleep
from light_progress.commandline import ProgressBar
n = 42
progress_bar = ProgressBar(n)
progress_bar.start()
for item in range(n):
sleep(0.01)
progress_bar.forward()
progress_bar.finish()
Pattern 2
Do iterations in with. start and finish do not have to be called explicitly.
from time import sleep
from light_progress.commandline import ProgressBar
n = 42
with ProgressBar(n) as progress_bar:
for item in range(n):
sleep(0.01)
progress_bar.forward()
Pattern 3
Transfer iteration.
from time import sleep
from light_progress.commandline import ProgressBar
ProgressBar(range(42), lambda item: sleep(0.01))
Colors
status |
color |
---|---|
In progress |
Blue |
Success |
Green |
Failur |
Red |
Widgets
ProgressBar can change the display format using widget.
from light_progress.commandline import widget
widgets = [widget.Bar(bar='=', tip='-'),
widget.Percentage(),
widget.Num()]
ProgressBar.iteration(
range(42), lambda item: sleep(0.01), widgets=widgets)
# [===============-...............] 50% (21/42)
widgets = [widget.Percentage(),
widget.Num(),
widget.Bar(bar='#', tip='>')]
ProgressBar.iteration(
range(42), lambda item: sleep(0.01), widgets=widgets)
# 50% (21/42) [###############>...............]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
light-progress-0.1.1.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for light_progress-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d374e6f78ec4dbf79d3df361dc1944b3fb54827505fca85d1890a31645ba76a4 |
|
MD5 | 08997b5dc93e95d22e8978613f959aad |
|
BLAKE2b-256 | 4a446f3d9930cea4687dd32e6fb0813a9af8a233272e5ed66f03104d62e67b89 |