Metadata-Version: 2.3
Name: bifurcate
Version: 0.1.0
Summary: Add your description here
Author: Wannes Vantorre
Author-email: Wannes Vantorre <vantorrewannes@gmail.com>
Requires-Python: >=3.14
Description-Content-Type: text/markdown

# bifurcate 🔀

**Emergent parallelism and execution branching from inside your functions.**

Standard patterns force you to extract your logic and wrap it in `for` loops or complex task graphs just to run variations of a pipeline. `bifurcate` lets you branch the execution graph dynamically from _inside_ the function itself.

Write your logic sequentially, as if it only runs once. Let the system magically map the permutations.

## Usage

```python
import bifurcate

@bifurcate.collapse
def calculate_pricing(user_id):
    # 1. Standard execution starts normally
    base_price = database.get_price(user_id)

    # BRANCH POINT:
    # The system transparently splits the execution universe here.
    # The function will conceptually branch, returning a different
    # value to 'discount' for each path.
    discount = bifurcate.split([0.0, 0.10, 0.20])

    # 2. This logic is evaluated cleanly for each distinct branch
    final_price = base_price * (1 - discount)

    print(f"Calculated: {final_price}")
    return final_price

# The decorator catches the parallel universes and aggregates the results
results = calculate_pricing("user_123")
# Output: [100.0, 90.0, 80.0]
```

## Features

- **In-line Branching:** No more `for` loops polluting your caller logic. Keep your domain functions completely isolated and focused on single-item math.
- **Zero-Boilerplate Permutations:** Perfect for A/B testing, ML hyperparameter sweeps, or fallback strategies.
- **The List Monad for Python:** Achieves mathematically pure map/flatMap operations using standard, highly-readable imperative Python syntax.

## Installation

```bash
uv add bifurcate
# or
pip install bifurcate
```
