Skip to main content

Colorful terminal progress bar with ETA and speed tracking

Project description

preview

Lightweight and stylish command-line progress bar written in pure Python with colorful ANSI output. Perfect for downloads, iterations, or pipelines where you want clean, responsive visual feedback.


🚀 Features

  • ⏱️ ETA and speed tracking
  • 🎨 Colorful and modern terminal output (no external dependencies)
  • 📦 Works as iterator or manual .update() style
  • ✅ Minimal and production-ready

🧪 Usage

from pipebar import ProgressBar

n = 100_000_000

with ProgressBar(total=n, unit='M', scale=1_000_000) as pbar:
    result = 0

    for i in range(n):
        result += i ** 2
        pbar.update()

print(f'Result: {result}')

📁 For file downloads

from pipebar import ProgressBar
import requests
import os

red = '\033[38;2;235;64;52m'
end = '\033[0m'

def download_file(url):
    url = url.strip('/')
    file_name = url.split('/')[-1]
    response = requests.get(url, stream=True)
    total_size = int(response.headers.get('content-length', 0))
    total_size_mb = total_size / (1024 * 1024)
    print(f'Downloading {file_name} ({total_size_mb:.1f} MB)')
    
    with ProgressBar(total=total_size, unit='MB', scale=1024*1024) as pbar:
        try:
            with open(file_name, 'wb') as file:
                for data in response.iter_content(chunk_size=1024):
                    file.write(data)
                    pbar.update(len(data))
        except KeyboardInterrupt:
            print(f'\n{red}ERROR: Aborted by user.{end}')
            if os.path.exists(file_name):
                os.remove(file_name)
            raise SystemExit(0)

download_file('http://ipv4.download.thinkbroadband.com/200MB.zip')

⚙️ ProgressBar Parameters

Parameter Type Default Description
iterable Iterable None Optional iterable to wrap. If provided, ProgressBar acts as a generator.
total int None Total number of units (e.g., items, bytes). Required for ETA/speed display.
unit str 'it' Unit name (e.g., 'MB', 'files', 'records'). Displayed after progress numbers.
scale int/float 1 Scale factor to convert units (e.g., 1024*1024 to convert bytes to MB).
bar_length int auto Visual length of the progress bar in characters. Auto-adjusts to terminal size if not set.

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

pipebar-1.0.3.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

pipebar-1.0.3-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file pipebar-1.0.3.tar.gz.

File metadata

  • Download URL: pipebar-1.0.3.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for pipebar-1.0.3.tar.gz
Algorithm Hash digest
SHA256 c1dfd6780b23abc44bd6e3202f05f983fb9f06c6c45c48b144cb2f061b9db34a
MD5 e540043af21fa1f26b1910c1679e21b9
BLAKE2b-256 6366b924a8477433efbd53955de0635888bb6e44258baf613493cbb27ae81ef8

See more details on using hashes here.

File details

Details for the file pipebar-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: pipebar-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for pipebar-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 922e0d9abe145f343757d2fd03179797bc11ca17b6cc8801ca1b9c6e32ba546c
MD5 219d5978fbed0cec88dcf95a48082090
BLAKE2b-256 9ceaaa664d7d5eb7361bbc6f5ee3974f83d51913c407eecd29540bd4416c22b4

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