Skip to main content

A simple progress bar

Project description

Simple Progress Bar

Simplicity is the ultimate sophistication.

—— Leonardo da Vinci

A simple and elegant progress bar library for Python, built on top of Rich.

Installation

pip install simple-pbar

Usage

Basic Usage

from simple_pbar import simple_pbar, SimpleTask
import time

with simple_pbar(
    SimpleTask(desc="Time consuming task", total=5),
) as pbar:
    for i in range(5):
        time.sleep(1)
        pbar.go()

Basic Usage

Multiple Tasks

from simple_pbar import simple_pbar, SimpleTask
import time

with simple_pbar(
    SimpleTask(name="epoch", desc="Epoch Iteration", total=5),
    SimpleTask(name="batch", desc="Batch Iteration", total=5),
) as pbar:
    for i in range(5):
        for j in range(5):
            time.sleep(1)
            pbar.go(name="batch", advance=1)
        pbar.go(name="epoch", advance=1)
        pbar.reset(name="batch")

Multiple Tasks

Customize Columns

from simple_pbar import simple_pbar, SimpleTask, SimpleColumn
import time

with simple_pbar(
    SimpleTask(name="epoch", desc="Epoch Iteration", total=5),
    SimpleTask(name="batch", desc="Batch Iteration", total=5),
    columns=[
        SimpleColumn(name="current", desc="Current Index"),
    ]
) as pbar:
    for i in range(5):
        pbar.update_column(name="epoch", column_name="current", value=i)
        for j in range(5):
            pbar.update_column(name="batch", column_name="current", value=j)
            time.sleep(1)
            pbar.go(name="batch", advance=1)
        pbar.go(name="epoch", advance=1)
        pbar.reset(name="batch")

Customize Columns

Log

from simple_pbar import simple_pbar, SimpleTask
import time

with simple_pbar(
    SimpleTask(desc="Time consuming task", total=5),
) as pbar:
    for i in range(5):
        pbar.log(f"Iteration {i} started")
        time.sleep(1)
        pbar.go()

Log

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_pbar-0.1.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file simple_pbar-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: simple_pbar-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for simple_pbar-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a8f82d4bbee3b3f3ccd6ce45f607024ac51f057fd9dc1226616d0ff683f6300
MD5 d9bdd552566a5f4231f8847385e72f02
BLAKE2b-256 74fe4f9cae0e0e521a041e34d31719371d0c7544f9d7dadef7389477c67f7d50

See more details on using hashes here.

Supported by

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