MultiProgress: the enriched progress bar
A simple to use progress_bar in sub-processes or threads using rich.
See the examples folder for more examples.
import time
import random
from concurrent.futures import ProcessPoolExecutor
from enriched_progress import MultiProgress, progress_bar
def do_work(n: int) -> int:
sleep_for = random.randint(0, 2)
for _ in progress_bar(
range(1, n + 2), desc=f"Sleeping for {sleep_for} secs for each {n} iterations."
):
time.sleep(sleep_for)
return sleep_for
def demo():
with ProcessPoolExecutor() as p, MultiProgress():
print(list(p.map(do_work, range(10))))
Install
pip install multiprog
Using Other Rich Features
import time
from rich.console import Console, Group
from rich.live import Live
from rich.panel import Panel
from concurrent.futures import ProcessPoolExecutor, as_completed
from enriched_progress import MultiProgress, progress_bar
import random
import os
def work(status_name: str) -> str:
for _ in progress_bar(
range(random.randint(2, 40)),
desc=f"Working on task for {status_name}",
metrics_func=lambda: dict(pid=os.getpid()),
):
time.sleep(random.random() * 2)
return status_name
def demo():
console = Console()
status = console.status("Working on tasks...")
with (
ProcessPoolExecutor() as p,
MultiProgress(transient=True)(live_mode=False) as mp,
Live(Panel(Group(status, mp))),
):
futures = [
p.submit(work, status_name)
for status_name in ("status1", "status2", "status3")
]
done = []
for f in as_completed(futures):
done.append(f.result())
status.update(f"[bold green]Done tasks: {','.join(done)}")
status.update("[bold green]All are done!!!")
if __name__ == "__main__":
demo()
Metadata
Release files for multiprog 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| multiprog-1.1.0.tar.gz | 13.7 kB | Without provenance | Details for multiprog-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| multiprog-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for multiprog-1.1.0-py3-none-any.whl |
Total release size: 24.0 kB
Release files / multiprog-1.1.0.tar.gz
| Download URL | multiprog-1.1.0.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
585a1b7c1e7862895b3562f8eb33953c21aba741700a2654c60201366d300674
|
|
BLAKE2b-256 checksum How to use checksums |
30be9481ae747940809dd444fb6b22aa77dee3ca374a4073d16d9bf7a2151015
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.6
|
Release files / multiprog-1.1.0-py3-none-any.whl
| Download URL | multiprog-1.1.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43f893584e15dc3176dd87490647948503e40fe0ad8ba25558a343545fb4a019
|
|
BLAKE2b-256 checksum How to use checksums |
88dbddc53b20e1aab2c3caeee82d52bbd60adb188f74086c67eca482fac81ccb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.6
|
Security for multiprog 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.