Skip to main content

Event-driven workflow orchestration framework with flexible connection, state management, and workflow orchestration capabilities

Project description

Routilux โšก

PyPI version Python 3.7+ License Documentation

Routilux is a powerful, event-driven workflow orchestration framework that makes building complex data pipelines and workflows effortless. With its intuitive API and flexible architecture, you can create sophisticated workflows in minutes, not hours.

โœจ Why Routilux?

  • ๐Ÿš€ Event-Driven Architecture: Build reactive workflows that respond to events naturally
  • ๐Ÿ”— Flexible Connections: Many-to-many relationships between routines with intelligent data routing
  • ๐Ÿ“Š Built-in State Management: Track execution state, performance metrics, and history out of the box
  • ๐Ÿ›ก๏ธ Robust Error Handling: Multiple strategies (STOP, CONTINUE, RETRY, SKIP) with automatic recovery
  • โšก Concurrent Execution: Automatic parallelization for I/O-bound operations
  • ๐Ÿ’พ Persistence & Recovery: Save and resume workflows from any point
  • ๐ŸŽฏ Production Ready: Comprehensive error handling, execution tracking, and monitoring

๐ŸŽฏ Perfect For

  • Data Pipelines: ETL processes, data transformation workflows
  • API Orchestration: Coordinating multiple API calls with complex dependencies
  • Event Processing: Real-time event streams and reactive systems
  • Workflow Automation: Business process automation and task scheduling
  • Microservices Coordination: Managing interactions between services
  • LLM Agent Workflows: Complex AI agent orchestration and chaining

๐Ÿ“ฆ Installation

Quick Install (Recommended)

pip install routilux

That's it! You're ready to go.

Development Install

For development with all dependencies:

pip install -e ".[dev]"
# Or using Makefile
make dev-install

๐Ÿš€ Quick Start

Create Your First Workflow in 3 Steps

Step 1: Define a Routine

from routilux import Routine

class DataProcessor(Routine):
    def __init__(self):
        super().__init__()
        # Define input slot
        self.input_slot = self.define_slot("input", handler=self.process_data)
        # Define output event
        self.output_event = self.define_event("output", ["result"])
    
    def process_data(self, data: str):
        result = f"Processed: {data}"
        self._stats["processed_count"] = self._stats.get("processed_count", 0) + 1
        self.emit("output", result=result)

Step 2: Create and Connect a Flow

from routilux import Flow

flow = Flow(flow_id="my_workflow")

processor1 = DataProcessor()
processor2 = DataProcessor()

id1 = flow.add_routine(processor1, "processor1")
id2 = flow.add_routine(processor2, "processor2")

# Connect: processor1's output โ†’ processor2's input
flow.connect(id1, "output", id2, "input")

Step 3: Execute

job_state = flow.execute(id1, entry_params={"data": "Hello, Routilux!"})
print(job_state.status)  # "completed"
print(processor1.stats())  # {"processed_count": 1}

๐ŸŽ‰ Done! You've created your first workflow.

๐Ÿ’ก Key Features

๐Ÿ”„ Event-Driven Execution

Routines communicate through events and slots, creating a natural, reactive flow:

# Multiple routines can listen to the same event
flow.connect(processor1, "output", processor2, "input")
flow.connect(processor1, "output", processor3, "input")  # Fan-out

# Multiple events can feed into the same slot
flow.connect(processor1, "output", aggregator, "input")
flow.connect(processor2, "output", aggregator, "input")  # Fan-in

๐ŸŽ›๏ธ Flexible State Management

Track everything automatically:

# Access routine state
stats = routine.stats()  # {"processed_count": 42, "errors": 0}

# Track execution history
history = job_state.get_execution_history()

# Performance metrics
perf = flow.execution_tracker.get_routine_performance("processor1")

๐Ÿ›ก๏ธ Built-in Error Handling

Choose the right strategy for your use case:

from routilux import ErrorHandler, ErrorStrategy

# Stop on error (default)
flow.set_error_handler(ErrorHandler(ErrorStrategy.STOP))

# Continue and log errors
flow.set_error_handler(ErrorHandler(ErrorStrategy.CONTINUE))

# Retry with exponential backoff
flow.set_error_handler(ErrorHandler(
    ErrorStrategy.RETRY,
    max_retries=3,
    retry_delay=1.0,
    backoff_multiplier=2.0
))

โšก Concurrent Execution

Automatic parallelization for better performance:

# Enable concurrent execution
flow.set_execution_strategy("concurrent", max_workers=4)

# Routines that can run in parallel are automatically executed concurrently
job_state = flow.execute(entry_routine_id)

๐Ÿ’พ Persistence & Recovery

Save and resume workflows:

# Save workflow state
job_state.save("workflow_state.json")

# Later, resume from saved state
saved_state = JobState.load("workflow_state.json")
flow.resume(saved_state)

๐Ÿ“š Documentation

๐Ÿ“– Full documentation available at: routilux.readthedocs.io

Documentation Highlights

  • ๐Ÿ“˜ User Guide: Comprehensive guide covering all features
  • ๐Ÿ”ง API Reference: Complete API documentation
  • ๐Ÿ’ป Examples: Real-world code examples
  • ๐Ÿ—๏ธ Design: Architecture and design principles

Build Documentation Locally

pip install -e ".[docs]"
cd docs && make html

๐ŸŽ“ Examples

Check out the examples/ directory for practical examples:

  • basic_example.py - Your first workflow
  • data_processing.py - Multi-stage data pipeline
  • concurrent_flow_demo.py - Parallel execution
  • error_handling_example.py - Error handling strategies
  • state_management_example.py - State tracking and recovery
  • builtin_routines_demo.py - Using built-in routines

Run examples:

python examples/basic_example.py

๐Ÿงฉ Built-in Routines

Routilux comes with a rich set of built-in routines ready to use:

  • Text Processing: TextClipper, TextRenderer, ResultExtractor
  • Data Processing: DataTransformer, DataValidator, DataFlattener
  • Control Flow: ConditionalRouter for dynamic routing
  • Utilities: TimeProvider for timestamps
from routilux.builtin_routines import ConditionalRouter, DataTransformer

# Use built-in routines directly
router = ConditionalRouter()
transformer = DataTransformer()

๐Ÿ—๏ธ Project Structure

routilux/
โ”œโ”€โ”€ routilux/              # Main package
โ”‚   โ”œโ”€โ”€ routine.py         # Routine base class
โ”‚   โ”œโ”€โ”€ flow.py            # Flow manager
โ”‚   โ”œโ”€โ”€ job_state.py       # State management
โ”‚   โ”œโ”€โ”€ connection.py      # Connection management
โ”‚   โ”œโ”€โ”€ event.py           # Event class
โ”‚   โ”œโ”€โ”€ slot.py            # Slot class
โ”‚   โ”œโ”€โ”€ error_handler.py   # Error handling
โ”‚   โ””โ”€โ”€ execution_tracker.py # Performance tracking
โ”œโ”€โ”€ tests/                 # Comprehensive test suite
โ”œโ”€โ”€ examples/              # Usage examples
โ””โ”€โ”€ docs/                  # Sphinx documentation

๐Ÿงช Testing

Routilux comes with comprehensive tests:

# Run all tests
make test-all

# Run with coverage
make test-cov

# Run specific test suite
pytest tests/                    # Core tests
pytest routilux/builtin_routines/  # Built-in routines tests

๐Ÿค Contributing

We welcome contributions! Here's how you can help:

  1. Star the project โญ - Show your support
  2. Report bugs ๐Ÿ› - Help us improve
  3. Suggest features ๐Ÿ’ก - Share your ideas
  4. Submit PRs ๐Ÿ”ง - Contribute code

๐Ÿ“„ License

Routilux is licensed under the Apache License 2.0. See LICENSE for details.

๐Ÿ”— Links

โญ Show Your Support

If Routilux helps you build amazing workflows, consider giving it a star on GitHub!


Built with โค๏ธ by the Routilux Team

Making workflow orchestration simple, powerful, and fun.

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

routilux-0.9.0.tar.gz (191.6 kB view details)

Uploaded Source

Built Distribution

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

routilux-0.9.0-py3-none-any.whl (82.4 kB view details)

Uploaded Python 3

File details

Details for the file routilux-0.9.0.tar.gz.

File metadata

  • Download URL: routilux-0.9.0.tar.gz
  • Upload date:
  • Size: 191.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for routilux-0.9.0.tar.gz
Algorithm Hash digest
SHA256 d84d16196e8dfb41e33bc6877cb1f8cc1f718e3d2e793e81b78bf261455be629
MD5 13ed7aab64e2605c2c511e580193a8a9
BLAKE2b-256 a76f11907b69512fb1bb7769513fca385e5124184e6ec7c23d0689048cb23470

See more details on using hashes here.

File details

Details for the file routilux-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: routilux-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 82.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for routilux-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ee85c016f208a9ff023cf0556732dfd06a194a18164935987ec75570e106366
MD5 27b50cc95546f75e8beadd19cf4c721c
BLAKE2b-256 06d2b6a0769195ec2d53554226d2db1f5600c76ab30d70e5d35769d289f0ae56

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