pipebar


Namepipebar JSON
Version 1.0.2 PyPI version JSON
download
home_pageNone
SummaryColorful terminal progress bar with ETA and speed tracking
upload_time2025-07-18 00:44:17
maintainerNone
docs_urlNone
authorカネキ
requires_python>=3.6
licenseNone
keywords progress bar terminal cli ansi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![preview](https://raw.githubusercontent.com/fabfawufawd/PipeBar/refs/heads/main/screen.png)

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

```python
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

```python
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. |

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pipebar",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "progress, bar, terminal, CLI, ansi",
    "author": "\u30ab\u30cd\u30ad",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/fb/da/cd6040c862f0e12ef29d01d7b5db03cf25153b86bb08181b9e8d1c6027b7/pipebar-1.0.2.tar.gz",
    "platform": null,
    "description": "![preview](https://raw.githubusercontent.com/fabfawufawd/PipeBar/refs/heads/main/screen.png)\n\nLightweight 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.\n\n---\n\n## \ud83d\ude80 Features\n\n- \u23f1\ufe0f ETA and speed tracking\n- \ud83c\udfa8 Colorful and modern terminal output (no external dependencies)\n- \ud83d\udce6 Works as iterator or manual `.update()` style\n- \u2705 Minimal and production-ready\n\n---\n\n## \ud83e\uddea Usage\n\n```python\nfrom pipebar import ProgressBar\n\nn = 100_000_000\n\nwith ProgressBar(total=n, unit='M', scale=1_000_000) as pbar:\n    result = 0\n\n    for i in range(n):\n        result += i ** 2\n        pbar.update()\n\nprint(f'Result: {result}')\n```\n\n---\n\n## \ud83d\udcc1 For file downloads\n\n```python\nfrom pipebar import ProgressBar\nimport requests\nimport os\n\nred = '\\033[38;2;235;64;52m'\nend = '\\033[0m'\n\ndef download_file(url):\n    url = url.strip('/')\n    file_name = url.split('/')[-1]\n    response = requests.get(url, stream=True)\n    total_size = int(response.headers.get('content-length', 0))\n    total_size_mb = total_size / (1024 * 1024)\n    print(f'Downloading {file_name} ({total_size_mb:.1f} MB)')\n    \n    with ProgressBar(total=total_size, unit='MB', scale=1024*1024) as pbar:\n        try:\n            with open(file_name, 'wb') as file:\n                for data in response.iter_content(chunk_size=1024):\n                    file.write(data)\n                    pbar.update(len(data))\n        except KeyboardInterrupt:\n            print(f'\\n{red}ERROR: Aborted by user.{end}')\n            if os.path.exists(file_name):\n                os.remove(file_name)\n            raise SystemExit(0)\n\ndownload_file('http://ipv4.download.thinkbroadband.com/200MB.zip')\n```\n\n---\n\n## \u2699\ufe0f ProgressBar Parameters\n\n| Parameter    | Type        | Default | Description                                                                                |\n| ------------ | ----------- | ------- | ------------------------------------------------------------------------------------------ |\n| `iterable`   | `Iterable`  | `None`  | Optional iterable to wrap. If provided, `ProgressBar` acts as a generator.                 |\n| `total`      | `int`       | `None`  | Total number of units (e.g., items, bytes). Required for ETA/speed display.                |\n| `unit`       | `str`       | `'it'`  | Unit name (e.g., `'MB'`, `'files'`, `'records'`). Displayed after progress numbers.        |\n| `scale`      | `int/float` | `1`     | Scale factor to convert units (e.g., `1024*1024` to convert bytes to MB).                  |\n| `bar_length` | `int`       | auto    | Visual length of the progress bar in characters. Auto-adjusts to terminal size if not set. |\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Colorful terminal progress bar with ETA and speed tracking",
    "version": "1.0.2",
    "project_urls": null,
    "split_keywords": [
        "progress",
        " bar",
        " terminal",
        " cli",
        " ansi"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "efc91674ce758fe6f8b87cb3c92ec1130301fd79e567a70ed1b482959818f96a",
                "md5": "558e42fd842f4b8874ffe2172a15f82d",
                "sha256": "71f69cc761f723d4431e0b89be7443a4a676bac9d0f8e885cb7503a9dc31e258"
            },
            "downloads": -1,
            "filename": "pipebar-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "558e42fd842f4b8874ffe2172a15f82d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4217,
            "upload_time": "2025-07-18T00:44:15",
            "upload_time_iso_8601": "2025-07-18T00:44:15.966710Z",
            "url": "https://files.pythonhosted.org/packages/ef/c9/1674ce758fe6f8b87cb3c92ec1130301fd79e567a70ed1b482959818f96a/pipebar-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fbdacd6040c862f0e12ef29d01d7b5db03cf25153b86bb08181b9e8d1c6027b7",
                "md5": "8016c4df36da40b1680eb35eeb2f1dad",
                "sha256": "903c890541547919204c15bfae9718524b7117adbb190622ec18af939c80fb03"
            },
            "downloads": -1,
            "filename": "pipebar-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "8016c4df36da40b1680eb35eeb2f1dad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3912,
            "upload_time": "2025-07-18T00:44:17",
            "upload_time_iso_8601": "2025-07-18T00:44:17.117425Z",
            "url": "https://files.pythonhosted.org/packages/fb/da/cd6040c862f0e12ef29d01d7b5db03cf25153b86bb08181b9e8d1c6027b7/pipebar-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-18 00:44:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pipebar"
}
        
Elapsed time: 1.73514s