Zero-input-serialization, GIL-free parallel map-reduce.
Project description
scissiparity 🦠
Zero-input-serialization, GIL-free parallel map-reduce.
Standard Python multiprocessing is a nightmare of PicklingErrors, explicit worker pools, and massive memory duplication because it forces you to serialize data in both directions. scissiparity solves this through asymmetric serialization: it natively clones the Python interpreter's memory space via OS-level Copy-On-Write to read inputs for free, and only serializes the strictly necessary outputs.
uv add scissiparity
The Difference
| Concept | multiprocessing.Pool |
scissiparity |
|---|---|---|
| Input Propagation | Serializes/Pickles inputs across IPC queues. | Zero-serialization. Reads parent memory natively via os.fork(). |
| Output Extraction | Pickles results via IPC queues. | Pickles results via native os.pipe() (dill). |
| Memory Overhead | Duplicates all inputs. | Zero-copy for inputs. OS-level Copy-On-Write mechanics. |
| Configuration | Requires manual chunking and worker sizing. | Zero config. Inferred purely from OS CPU topography. |
Usage
You write standard $N=1$ domain logic. The @fission decorator mathematically divides the incoming iterable, fractures the interpreter, and natively routes the yielded results backward via pipe multiplexing.
from scissiparity import fission
# 1. A massive or unpicklable object lives in the parent process.
# A standard multiprocessing.Pool would crash trying to serialize this across IPC.
MASSIVE_UNPICKLABLE_STATE = {"user_1": <OpenDatabaseConnection>, "user_2": ...}
@fission
def process_users(user_ids: list[str]):
# Protect the Linear Illusion: The user writes simple, sequential logic.
for uid in user_ids:
# 2. Downward Flow (Zero-serialization):
# Child processes read the parent's memory directly via OS-level Copy-On-Write.
state = MASSIVE_UNPICKLABLE_STATE[uid]
computed_value = heavy_cpu_computation(state)
# 3. Upward Flow (Serialization):
# Only the minimal resulting data is serialized (via dill) and piped back.
yield computed_value
# Execution naturally fissions into N processes (where N = os.cpu_count()).
# Results are multiplexed back to the parent natively as a linear stream.
results = list(process_users(["user_1", "user_2", "user_3", ...]))
Core Mechanics
- Asymmetric Serialization (Copy-On-Write): Because it leverages standard UNIX
os.fork(), child processes can read the parent's massive in-memory variables instantly. You can process objects that are entirely unpicklable. Serialization (dill) is invoked only to pipe the final yielded results back to the parent. - Exception Teleportation: If a child process raises an Exception, the error is natively serialized, piped back to the parent, and re-raised in the main thread. If one child dies, the workflow aborts gracefully. Zero "ghost compute."
- Zero Configuration: There are no
workers=8arguments. The decorator strictly aligns to the native physics of your machine by inspectingos.sched_getaffinity(0)oros.cpu_count().
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scissiparity-0.1.1.tar.gz.
File metadata
- Download URL: scissiparity-0.1.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3548be4c9c2cc1b3d9cc3a5bfcc93b2446e61cc13bae276eeb3b69665033a01
|
|
| MD5 |
969654aa2540e9520eebc3353f45bd7f
|
|
| BLAKE2b-256 |
2358980964006f74f09a01ab56018f415469b4430005060a55d21f2cdd805553
|
File details
Details for the file scissiparity-0.1.1-py3-none-any.whl.
File metadata
- Download URL: scissiparity-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b71dfd80cea8fbf90f411b014026cd805f5841d5777dd1df9b3b95bb95f7c051
|
|
| MD5 |
110cee0aeda2c3bdd9655c4d40f4baa6
|
|
| BLAKE2b-256 |
208e5caf02167c8d2cf05684dcce3660ed964dcba995c3d013b01c874366a32a
|