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)
Installation
pip install light-progress
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.iteration(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.2.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for light_progress-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cf14e685fd626993dbb0261666c6f8f53a89eca9a055a84a04f59761b4e7a6e |
|
MD5 | a8646ea418f37a2d52ca75a8632d0b3b |
|
BLAKE2b-256 | b2ef06a29b446b9a1894742fd411918c35f91c1ea4fe47828b41243054552f30 |