Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for light-progress, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size light_progress-0.1.2-py3-none-any.whl (2.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size light-progress-0.1.2.tar.gz (2.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page