Metadata-Version: 2.3
Name: scissiparity
Version: 1.0.0
Summary: Zero-input-serialization, GIL-free parallel map.
Keywords: parallelism,concurrency,futures,asyncio,decorator,copy-on-write
Author: Wannes Vantorre
Author-email: Wannes Vantorre <vantorrewannes@gmail.com>
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Dist: dill>=0.4.1
Requires-Python: >=3.14
Project-URL: Homepage, https://codeberg.org/ProductionCode/scissiparity
Project-URL: Repository, https://codeberg.org/ProductionCode/scissiparity
Project-URL: Issues, https://codeberg.org/ProductionCode/scissiparity/issues
Description-Content-Type: text/markdown

# 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.

```bash
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.

```python
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.
