Skip to main content

Parallel map with an optional rich progress bar.

Project description

parvelo

A tiny utility for parallel map with a rich progress bar.

parvelo.parallel_map runs a function over an iterable using either a process pool (CPU-bound work) or a thread pool (I/O-bound work), preserves input order, and optionally renders a progress bar.

parallel_map progress bar

Install

pip install parvelo

From source:

git clone https://github.com/h-ahl/parvelo.git
cd parvelo
uv sync --extra lint --group dev

Usage

from parvelo import Backend, parallel_map


def square(x: int) -> int:
    return x * x


# CPU-bound work across processes (default)
results = parallel_map(square, range(10))

# I/O-bound work across threads
results = parallel_map(fetch, urls, backend=Backend.THREAD, n_workers=16)

# Run serially (handy for debugging), skipping executor overhead
results = parallel_map(square, range(10), n_workers=1)

Reusing or injecting your own executor

Pass an executor to reuse a caller-owned pool across calls instead of creating one each time. Any object with a concurrent.futures-style map(func, *iterables, chunksize=1) qualifies (matched by the ExecutorLike protocol), so a stdlib executor or a custom wrapper around a ray/jax pool both work. When executor is provided, backend, n_workers, and multiprocessing_context are ignored, and parvelo does not shut the executor down (you own its lifecycle).

from concurrent.futures import ProcessPoolExecutor
from parvelo import parallel_map


with ProcessPoolExecutor() as pool:
    a = parallel_map(square, range(10), executor=pool)
    b = parallel_map(square, range(10, 20), executor=pool)  # pool reused, not recreated

Development

just setup       # create the environment
just test        # run the test suite
just lint        # ruff check
just format      # ruff format
just pre-commit  # run all pre-commit hooks

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parvelo-0.3.0.tar.gz (73.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parvelo-0.3.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file parvelo-0.3.0.tar.gz.

File metadata

  • Download URL: parvelo-0.3.0.tar.gz
  • Upload date:
  • Size: 73.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for parvelo-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1e3d128338f0e1454d09e0c83715e50c815c82ba7df66b88ba52cd04067c89a1
MD5 c46f48b1e2f79e41f0f963156c758d31
BLAKE2b-256 50509ec10a757fa5a0a56e41efd06688c09e247f1240a62d87adfa52207fb54d

See more details on using hashes here.

Provenance

The following attestation bundles were made for parvelo-0.3.0.tar.gz:

Publisher: release.yml on h-ahl/parvelo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parvelo-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: parvelo-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for parvelo-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a08114da2175c3a9ee330dc0d4d6c9989de0bbc5da87216f95230d77ac0556b7
MD5 41ed6c85574d7a9a919bd103d52985b5
BLAKE2b-256 384b3d4f14cde39d8791a502ad3188128ecdd8baa51f3c18cc9a761f7225dd51

See more details on using hashes here.

Provenance

The following attestation bundles were made for parvelo-0.3.0-py3-none-any.whl:

Publisher: release.yml on h-ahl/parvelo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page