Skip to main content

Zero-input-serialization, GIL-free parallel map.

Project description

scissiparity 🦠

Zero-input-serialization, GIL-free parallel map.

multiprocessing forces you to serialize data in both directions, so large or unpicklable inputs crash or blow up memory. scissiparity clones the interpreter with os.fork(), reads inputs for free through Copy-On-Write, and serializes only the results you yield.

uv add scissiparity

Usage

Write ordinary sequential logic over a chunk. The @fission decorator splits the iterable across your CPU cores, runs a forked process per chunk, and merges the yielded results into one lazy stream.

from collections.abc import Iterator

from scissiparity import fission

MASSIVE_UNPICKLABLE_STATE = load_everything_into_memory()


@fission
def process_users(user_ids: list[str]) -> Iterator[float]:
    for user_id in user_ids:
        state = MASSIVE_UNPICKLABLE_STATE[user_id]
        yield heavy_cpu_computation(state)


results = list(process_users(["user_1", "user_2", "user_3"]))

Properties

  • See-through types. @fission preserves the wrapped signature. Element and keyword-argument types survive the decoration, so type checkers infer process_users(...) -> Iterator[float] with no annotations lost.
  • Zero input serialization. Children read the parent's memory natively via Copy-On-Write; only yielded outputs are piped back (via dill). Unpicklable inputs are fine.
  • Exception teleportation. An exception in a child is serialized, piped back, and re-raised in the parent. One failure aborts the run.
  • Composes without fork-bombing. A @fission function called from inside another runs sequentially, so simple cells combine into larger pipelines.
  • Zero configuration. Parallelism is inferred from os.sched_getaffinity(0) (falling back to os.cpu_count()). There are no workers= knobs.

Results are streamed back in completion order, not input order.

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

scissiparity-1.0.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

scissiparity-1.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file scissiparity-1.0.0.tar.gz.

File metadata

  • Download URL: scissiparity-1.0.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for scissiparity-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d41ada228af660b31d346de09c4030ef688d4c2720c2655424b2586e2c45706f
MD5 78ac3d04d2ea60dbfa4ca0417a173899
BLAKE2b-256 90a08f5e9b2e1353a624f7ec86f2d080e1a9c841c643fa832d726a5c1fa46821

See more details on using hashes here.

File details

Details for the file scissiparity-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: scissiparity-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for scissiparity-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 389a69943ea2bd39b2dfc4ca72b25a22972536be8b2eb84c4e73f8f47d27da16
MD5 c0e1f88f7ce60bf4a88af01539246778
BLAKE2b-256 a04abcf5cb576b11e1fec755c7c827723419589a294da2b9547745979bc6005e

See more details on using hashes here.

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