p_tqdm: Parallel Processing with Progress Bars

1.4.2 · active · verified Thu Apr 16

p_tqdm is a Python library that simplifies parallel processing by wrapping `pathos.multiprocessing` with `tqdm` progress bars. It provides a flexible parallel map functionality, supporting lambda functions, nested functions, and class methods, while displaying a clear progress bar with estimated time to completion. The library is actively maintained, with version 1.4.2 being the current release as of August 2024, and receives updates to ensure compatibility and address issues.

Common errors

Warnings

Install

Imports

Quickstart

This example demonstrates how to use `p_map` to apply a function in parallel to elements from multiple iterables, displaying a progress bar. The `my_function` simulates a task by sleeping briefly and then adding two numbers.

from p_tqdm import p_map
import time

def my_function(x, y):
    time.sleep(0.01) # Simulate work
    return x + y

l1 = [i for i in range(100)]
l2 = [i * 2 for i in range(100)]

results = p_map(my_function, l1, l2)
print(f"First 5 results: {results[:5]}")

view raw JSON →