tqdm-joblib

0.0.5 · active · verified Thu Apr 16

tqdm-joblib is a Python library that provides a context manager to easily integrate `tqdm` progress bars with `joblib.Parallel` execution. It addresses the challenge of displaying accurate and non-interfering progress updates when performing parallel computations with `joblib`. The current version is 0.0.5, and it appears to be actively maintained with recent releases.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use the `tqdm_joblib` context manager to wrap a `joblib.Parallel` call, automatically adding a progress bar for the parallel execution. The `desc` and `total` parameters are passed directly to `tqdm`.

from math import sqrt
from joblib import Parallel, delayed
from tqdm_joblib import tqdm_joblib

def calculate_sqrt(x):
    # Simulate some work
    # time.sleep(0.01) # Uncomment to make tasks longer
    return sqrt(x ** 2)

# Using tqdm_joblib as a context manager
with tqdm_joblib(desc="My calculation", total=100) as progress_bar:
    results = Parallel(n_jobs=2)(delayed(calculate_sqrt)(i) for i in range(100))

print(f"First 5 results: {results[:5]}")

view raw JSON →