Skip to main content

tqdm with a live rate graph, smarter ETA, and ASCII animations.

Project description

twoqdm

twoqdm is a drop-in tqdm wrapper for long-running Python loops. It keeps the normal progress bar and API while adding a live terminal panel with recent it/s history, colored trend direction, jitter, a smarter ETA hint, and ASCII loading animations.

Demo

twoqdm terminal progress demo

Install

python3 -m pip install twoqdm

For local development from this repository:

python3 -m pip install -e ".[dev]"

Use

Replace the import and leave the rest of your existing tqdm code unchanged:

# Before: from tqdm import tqdm
from twoqdm import tqdm

for record in tqdm(records, desc="processing"):
    process(record)

trange is available as a matching drop-in shortcut:

from twoqdm import trange

for i in trange(500, desc="training"):
    train_step(i)

ASCII animations are enabled by default. Each progress bar independently chooses one of the built-in animations using system randomness:

Name Animation
coffee Steam curls above a hot cup
train A locomotive rolls over moving track
conveyor A continuous line of packages travels down a conveyor
sand-pile A sand pile grows with the bar's completion percentage

Pin a specific animation, request another random choice, or disable it:

tqdm(records, ascii_spinner="conveyor")
tqdm(records, ascii_spinner="random")
tqdm(records, ascii_spinner=False)

Inspect the available names and adjust looping frame speed in seconds:

from twoqdm import available_ascii_spinners, trange

print(available_ascii_spinners())

for i in trange(
    500,
    desc="training",
    ascii_spinner="conveyor",
    ascii_spinner_interval=0.10,
):
    train_step(i)

Unlike the looping animations, sand-pile is tied to progress and reaches its fullest frame when the bar reaches 100%:

for record in tqdm(records, ascii_spinner="sand-pile"):
    process(record)

Preview one from this checkout with:

python3 examples/show_twoqdm.py --ascii-spinner conveyor --quick

The responsive panel hides the animation when the terminal is narrower than 90 columns so the ETA details remain readable.

Terminal resizing is automatic for TTY output. On the next progress update, both the tqdm line and trend panel clear and redraw for the new row and column count. Pass ncols=N or dynamic_ncols=False to keep a fixed bar width.

Disable color output with:

TQDM_TREND_NO_COLOR=1 python3 your_script.py

Build

rm -rf build dist src/*.egg-info
python3 -m pytest
python3 -m build
python3 -m twine check dist/*

Publish

Create a PyPI API token, then upload:

python3 -m twine upload dist/*

PyPI does not allow re-uploading the same version. Bump the version in pyproject.toml and src/twoqdm/__init__.py before publishing a new release.

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

twoqdm-0.3.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

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

twoqdm-0.3.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file twoqdm-0.3.0.tar.gz.

File metadata

  • Download URL: twoqdm-0.3.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for twoqdm-0.3.0.tar.gz
Algorithm Hash digest
SHA256 dcd1281cfce113e55933dce2a85a4e147073e31970dab8692f1dd422370d9163
MD5 ca5fad1be94547680475eda928765bb0
BLAKE2b-256 1d9b53518b60db3f24b03f91e20829b378167bf04ee92de05a7d2ed754852c7c

See more details on using hashes here.

File details

Details for the file twoqdm-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: twoqdm-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for twoqdm-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9822188d2a8f22e10a6b6291e92f95bda89aec651b5b3f419d3af0243e212c77
MD5 5840092acc5d841736e763c740ab3ef6
BLAKE2b-256 ed1fff0b8e9c4ec9f30ff4cb13899fa57a0a3411ca860409d1b199736de935bb

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