Skip to main content

🐍⚡ pyodide-pool

Run Python callables and dask graphs in parallel on a pool of Pyodide Web Workers.

🔗 Live Demo · Source

A single Pyodide interpreter is strictly single-threaded (no -pthread, no fork), so parallelism means many interpreters. pyodide-pool is the driver-side Python API for a pool of Web Workers (browser) or worker_threads (Node), each hosting its own Pyodide interpreter:

  • submit — run one cloudpickled call on a worker and await its result.
  • compute / get — an async dask scheduler that executes dask.delayed / dask.bag / dask-array graphs in parallel on the pool.
  • Package mirroring — packages loaded in the driver (e.g. numpy) are installed on each worker on first use.
  • Remote errors — the original Python exception is re-raised on the driver with the worker traceback chained.

The package runs only in the driver Pyodide instance; workers never install it. It is async-first: blocking the driver would starve the event loop the pool lives on.

Usage

import dask
import pyodide_pool

# In JupyterLite: import the JS bundle and start 4 nested workers
pool = await pyodide_pool.create_pool(pool_size=4)

value = await pyodide_pool.submit(fn, *args, **kwargs)  # one remote call
total = await pyodide_pool.compute(dask.delayed(sum)([...]))  # dask collections

create_pool imports the self-contained JS bundle that ships inside the wheel; pass js_url= to load a hosted copy instead. A web app that embeds Pyodide can instead create the JS PyodidePool itself and register it with pyodide.registerJsModule('js_pyodide_pool', { pool }).

Install pyodide-pool[dask] for compute / get.

For the multiprocessing-style API, see wasm-multiprocessing.

Documentation

License

MIT

Metadata

Release files for pyodide-pool 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pyodide-pool 0.2.1
File Interpreter ABI Platform Actions
pyodide_pool-0.2.1-py3-none-any.whl Python 3 none any Details for pyodide_pool-0.2.1-py3-none-any.whl

Release files / pyodide_pool-0.2.1-py3-none-any.whl

Download URL pyodide_pool-0.2.1-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db4c57100a7d95b6a10d1dfddd7b5088a9ecf3aa4494914a5fbe6171278fd6db
BLAKE2b-256 checksum
How to use checksums
dea05665c2eca1dbb80b8a3a459640d7e9d17521867eda08cbd356888a9a1413
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for pyodide-pool 0.2.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page