Skip to main content

Emergent parallelism and execution branching from inside your functions

Project description

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

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

uv add bifurcate
# or
pip install bifurcate

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

bifurcate-0.1.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

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

bifurcate-0.1.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file bifurcate-0.1.1.tar.gz.

File metadata

  • Download URL: bifurcate-0.1.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","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 bifurcate-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4fce3fe958c125d81adf7fa01fd8d927cbd0c2ff42afab2380ddaa643c1fad6d
MD5 afe4298a109ee8907b36899682f76159
BLAKE2b-256 9e29856bc975919c3754fa745d5a52e00cdca10f1f261ab9c1b32b6290ae8133

See more details on using hashes here.

File details

Details for the file bifurcate-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bifurcate-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","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 bifurcate-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8848a1774529c14b709b178799476fac5cab1db4a7a34d2e17699a7ea9e1ca7b
MD5 41b78108f2f1e6720dd1cd66617a6c1d
BLAKE2b-256 11e0d7a38294c4dba420ec0d28e601a1df34b535e666919f326a1f486be40a99

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