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.
@fissionpreserves the wrapped signature. Element and keyword-argument types survive the decoration, so type checkers inferprocess_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 with its original traceback and chained causes
intact (via
tblib), so failures read exactly as they would in-process. One failure aborts the run. - Composes without fork-bombing. A
@fissionfunction 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 toos.cpu_count()). There are noworkers=knobs.
Results are streamed back in completion order, not input order.
PyTorch & transformer models
scissiparity is an excellent fit for CPU inference: os.fork() lets every
worker share the loaded model weights through Copy-On-Write, so a multi-gigabyte
model is loaded into memory once — not re-serialized or re-loaded per worker.
- Load the model before applying
@fission, and don't run tensor ops in the parent first.fork()duplicates only the calling thread, so a live BLAS/OpenMP thread pool can deadlock the children. - Set
torch.set_num_threads(1)andTOKENIZERS_PARALLELISM=falseso process-level and library-level parallelism don't oversubscribe your cores.
CUDA / GPU is not supported. A CUDA context cannot survive os.fork() (it
raises Cannot re-initialize CUDA in forked subprocess), and GPU memory is not
Copy-On-Write shareable, so the core advantage doesn't apply. Use spawn-based
tooling such as torch.multiprocessing for GPU workloads.
Release files for scissiparity 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scissiparity-2.0.0.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scissiparity-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / scissiparity-2.0.0.tar.gz
| Download URL | scissiparity-2.0.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00d506a9a81baeec8c6ad722b3426f354b05049e84702ff6bf42ffa9b6fccb85
|
|
BLAKE2b-256 checksum How to use checksums |
e5eb11d12b732c1e24349437098ab356517869e29a2a839c95a33881e02bf47f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / scissiparity-2.0.0-py3-none-any.whl
| Download URL | scissiparity-2.0.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
685f99d780b142b11c882b11053ce0b71b819e034fb044389ab8e5206c6077cb
|
|
BLAKE2b-256 checksum How to use checksums |
2fc1ca4820fd6d7bec9d349e8c2de4135c381b246ed31fab0c2422c8432bf65d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|