Minimal terminal download UI
Project description
Mini Download UI
A minimalist and cross-platform Python module providing a terminal download using ANSI escape sequences.
This project focuses on simplicity and clarity:
- No external dependencies
- Pure Python
- Works on Linux, macOS and modern Windows terminals
Features
- APT style progress bar
- Log area displayed above the progress bar
- Progress percentage indicator
- Adaptive to terminal size
- ANSI-based rendering
- Simple and explicit usage
Requirements
- Python 3.8+
- ANSI-compatible terminal
- Linux terminals
- macOS Terminal / iTerm2
- Windows Terminal, PowerShell 7+, WSL
Installation
No installation step required.
Simply install the lib with pip
pip install mini-download-ui
Basic Usage
from mini_dl_ui import DownloadUI
import time
ui = DownloadUI()
for i in range(101):
ui.progress(i)
ui.log(f"Downloading package {i}/100")
time.sleep(0.05)
ui.close()
Alternative Usage
from mini_dl_ui import DownloadUI
import time
with DownloadUI() as ui:
for i in range(101):
if i in (10, 40, 70):
ui.log(f"Downloading package {i}/100")
ui.progress(i)
time.sleep(0.03)
ui.log("Finished.")
time.sleep(0.5)
Example Terminal Output
[LOG] Downloading package 48/100
[LOG] Downloading package 49/100
[LOG] Downloading package 50/100
--------------------------------------------------
[########## ] 50%
Threaded Usage
import threading
import time
from mini_dl_ui import DownloadUI
ui = DownloadUI(fill='=')
def worker():
for i in range(101):
ui.progress(i)
ui.log(f"Chunk {i} received")
time.sleep(0.03)
ui.close()
threading.Thread(target=worker).start()
Example Terminal Output
[LOG] Downloading package 48/100
[LOG] Downloading package 49/100
[LOG] Downloading package 50/100
--------------------------------------------------
[========= ] 50%
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mini_download_ui-1.0.1.tar.gz.
File metadata
- Download URL: mini_download_ui-1.0.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a664a2a5a96d85f3b24bd2a9982a87ceda554be35a4dfb0b801942b121180eb
|
|
| MD5 |
244774289a99ed22140ff0b076afb1b2
|
|
| BLAKE2b-256 |
bac506c2b42dee901dd1c046056e46e834518fe61a5ac0f40ca3472abedfb894
|
File details
Details for the file mini_download_ui-1.0.1-py3-none-any.whl.
File metadata
- Download URL: mini_download_ui-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b1f2254a214cad57b98c22f6b9022da9dc08dbf97a93c41faa453528ea3a0df
|
|
| MD5 |
c58d42c0a03b2fd5afeed1d9f640c721
|
|
| BLAKE2b-256 |
abc2e18c333de43b42f8676484b468dbc316e2d11c47fa5e7e5f1f142ccaa61c
|