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.

Source Distribution

light-progress-0.1.2.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

light_progress-0.1.2-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page