Skip to main content

A Python framework for parallel execution with automatic dependency resolution and variable capture.

Project description

Ripplex

A Python framework for parallel execution with automatic dependency resolution and variable capture.

Features

  • @flow decorator: Automatically parallelize function execution based on dependencies
  • @loop decorator: Simple parallel loops with automatic variable capture
  • Visual debugging: See execution progress in real-time
  • Error handling: Multiple strategies for dealing with failures
  • Zero-config: Works out of the box with sensible defaults

Installation

pip install ripplex

Quick Start

Simple Parallel Loop

from ripplex import loop

items = [1, 2, 3, 4, 5]
multiplier = 10

@loop(items)
def process(item):
    # 'multiplier' is automatically captured from the outer scope!
    return item * multiplier

print(process)  # [10, 20, 30, 40, 50]

Automatic Parallelization with @flow

from ripplex import flow
import time

@flow(debug=True)
def data_pipeline():
    # These run in parallel automatically
    data1 = fetch_source_1()
    data2 = fetch_source_2()
    
    # This waits for both to complete
    combined = merge(data1, data2)
    
    # These transformations run in parallel
    result1 = transform_a(combined)
    result2 = transform_b(combined)
    
    return result1, result2

Error Handling

@loop(items, on_error="collect")
def safe_process(item):
    return risky_operation(item)

if not safe_process.all_successful:
    print(f"Failed items: {safe_process.errors}")

Progress Tracking

@loop(large_list, debug=True)
def slow_operation(item):
    # Progress bar shows automatically
    return expensive_computation(item)

API Reference

@flow(debug=False)

Decorator that analyzes function dependencies and runs independent operations in parallel.

  • debug: Show visual execution timeline

@loop(iterable, *, workers=None, debug=False, on_error="continue")

Decorator for parallel loops with automatic variable capture.

  • iterable: Items to process (or an int for range)
  • workers: Number of threads (default: number of items, max 32)
  • debug: Show progress bar
  • on_error: How to handle errors
    • "continue": Skip failed items (default)
    • "raise": Stop on first error
    • "collect": Continue but keep None for failed items

pmap(fn, iterable, **kwargs)

Functional alternative to @loop decorator.

from ripplex import pmap

results = pmap(lambda x: x ** 2, [1, 2, 3, 4])

Advanced Features

Nested Loops in Flows

@flow(debug=True)
def complex_pipeline():
    categories = fetch_categories()
    
    @loop(categories)
    def process_category(cat):
        items = fetch_items(cat)
        
        @loop(items)
        def process_item(item):
            # Both 'cat' and 'item' are available
            return transform(item, cat)
        
        return summarize(process_item)
    
    return process_category

Custom Worker Pools

# Limit parallelism for resource-intensive tasks
@loop(items, workers=4)
def gpu_operation(item):
    return heavy_compute(item)

Debugging

Both decorators support visual debugging:

  • @flow(debug=True): Shows execution DAG and timing
  • @loop(items, debug=True): Shows progress bar with success/error counts

Contributing

PRs welcome! Please include tests for new features.

License

MIT

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

ripplex-1.0.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

ripplex-1.0.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file ripplex-1.0.0.tar.gz.

File metadata

  • Download URL: ripplex-1.0.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ripplex-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2ef59d3fd56d1f0a22d989a4a09422b81adb987ecfe75007071eb3460dc25c1b
MD5 f8c6317211b1bf70e280eea574a3816d
BLAKE2b-256 0f1568f982f9da71bbc8f62533983b2136cbd2274386faaa1753d36a22f444f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for ripplex-1.0.0.tar.gz:

Publisher: publish.yml on SethBurkart123/ripplex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ripplex-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ripplex-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ripplex-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3977fd19fbc002f7c8aed79297865a820089ed1a577a93ee7216a838d2a1f9b
MD5 68790e7d5f921fe7d989959230707486
BLAKE2b-256 93abbefd21ba5dcb17140d74249426c3ae6f522fe130baf101e925b8fb7f12b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ripplex-1.0.0-py3-none-any.whl:

Publisher: publish.yml on SethBurkart123/ripplex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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