Skip to main content

A lightweight package to create and manage data pipelines.

Project description

RapidPipe: Advanced Data Orchestration Framework

RapidPipe is a high-performance, asynchronous-capable, and history-aware pipeline execution framework for Python. It provides an elegant, expressive syntax for defining directed acyclic graphs (DAGs) of computational layers, complete with built-in temporal windowing, dynamic task-graph scheduling, and live visualization.

Built from the ground up to support both synchronous (CPU-bound) and asynchronous (I/O-bound) operations natively, RapidPipe eliminates the boilerplate of thread pools and event loops, letting you focus entirely on your transformation logic.


🌟 Key Features

  • Intuitive Dependency Resolution: Declare inputs via powerful string semantics (e.g., "signal.value[-3:]" or "camera.frame") and let the framework automatically calculate topology and data-retention requirements.
  • Fine-Grained Task Scheduling: Pipeline cycles run using an optimized asyncio task-graph. Layers launch the exact microsecond their dependencies resolve, eliminating synchronous layer-barrier penalties.
  • Smart Execution Modes (AUTO): The pipeline performs static analysis on your DAG to automatically assign the most efficient threading or inlining constraints. Isolated layers execute inline to avoid overhead, while functionally independent branches inherently parallelize.
  • Built-in Temporal History: Read from past cycles trivially. The pipeline automatically maintains rolling deques for each output, sized strictly to what downstream layers need.
  • Interactive D3.js Visualization: Instantly generate physics-based, interactive HTML maps of your architecture, tracking specific execution modes, topological layout, and (optionally) live latency metrics.
  • Nested Pipelines: Use a full Pipeline as a standard Layer inside another pipeline, easily building highly composable and reusable sub-architectures.
  • Hot-swapping & Modifiability: Dynamically add, remove, or hot-swap layers at runtime using .replace_layer() with zero downtime, preserving relevant historical states.

🏗️ Core Concepts

1. Layers (Layer)

A layer is the fundamental unit of computation. Every layer must define its expected inputs and outputs during __init__, and implement a process() (and/or async def aprocess()) method.

from rapidpipe import Pipeline, Layer

class SensorLayer(Layer):
    def __init__(self):
        super().__init__(name="sensor", outputs=["temperature"])

    def process(self):
        return 22.5  # Returns to "temperature"

class LoggerLayer(Layer):
    def __init__(self):
        super().__init__(name="logger", inputs={"temp": "sensor.temperature"})

    def process(self, temp):
        print(f"Logged temperature: {temp}")

2. Execution Modes

Layers can specify an execution_mode:

  • AUTO (Default): Dynamically optimizes. If the layer has an aprocess(), it executes as an async task. If symmetric concurrent branches exist, it executes in a THREAD. If it sequentially blocks all execution (no peers), it safely executes INLINE.
  • ASYNC: Enforces execution on the asyncio event loop (requires aprocess()). Ideal for I/O waits, sockets, and API calls.
  • THREAD: Enforces execution onto a concurrent ThreadPool. Ideal for CPU-bound computations that release the GIL (e.g., Pandas/Numpy operations).
  • INLINE: Forces blocking, synchronous execution directly on the main orchestration thread. Best for trivial logic where threading overhead costs more than the process itself.

3. Smart History Variables

Access historical execution output immediately simply by slicing dependencies:

  • Current value: "layer.variable" (Creates a strict cyclic dependency).
  • Previous value: "layer.variable[-1]" (Refers to 1 cycle ago).
  • Index range (Windowing): "layer.variable[-3:]" (List array of the last 3 values).
  • Time range: "layer.variable[-2.5s:]" (Values from the last 2.5 seconds).

Note: Sliced dependencies ([-1], [-3:]) are considered chronological requirements, meaning they do not block execution synchronously in the current DAG topological cycle.


🚀 Advanced Capabilities

Interactive Diagnostics

Diagnose bottlenecks and verify DAG structures visually:

pipe.show_graph(name="My Pipeline", free=True)

Creates a dynamic local HTML/D3.js instance coloring .layer topologies by dependencies!

State Serialization

Stop a pipeline, save its history bounds to disk, and revive it effortlessly:

pipe.save_state("monday_run.pkl")
# ... later, or in a fresh node:
pipe.load_state("monday_run.pkl")

Numba Integration

Included numba_layer.py seamlessly allows ultra-fast JIT-compiled matrix mathematics natively pipelined without escaping the Python DAG.

Performance Metrics & Profiling

Pass a MetricsCollector to the Pipeline, run benchmarks, and examine .summary() to inspect median latencies, jitter, and P99 latency times inside of layers.


📂 Project Structure

rapidpipe/
├── src/rapidpipe/         # Core Framework (Layer, Pipeline, Metrics)
│   └── utils/             # Visualization tools (D3.js generation)
├── examples/              # Educational blueprints & implementation demos
│   ├── 01_basic_pipeline.py
│   ├── 02_dag_parallelism.py
│   ├── 03_history_and_windowing.py
│   └── ...
└── tests/                 # Pytest validation suites ensuring deterministic
    └── ...                  pipeline features and error boundaries.

🛠 Usage & Quickstart

  1. Prerequisites: Python 3.10+ highly recommended.
  2. Installation: Since this relies closely on native asyncio and nx graphing patterns (with visualization HTMLs), ensure your virtual environment installs the base standard tooling via pyproject.toml.
  3. Examples: Navigate to examples/ and run any script to see it in action!
    python examples/01_basic_pipeline.py
    # or
    uv run examples/01_basic_pipeline.py
    
  4. Testing: Run the internal suite using standard pytest:
    pytest tests/
    

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

rapidpipe-1.0.2.tar.gz (33.2 kB view details)

Uploaded Source

Built Distribution

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

rapidpipe-1.0.2-py3-none-any.whl (36.7 kB view details)

Uploaded Python 3

File details

Details for the file rapidpipe-1.0.2.tar.gz.

File metadata

  • Download URL: rapidpipe-1.0.2.tar.gz
  • Upload date:
  • Size: 33.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rapidpipe-1.0.2.tar.gz
Algorithm Hash digest
SHA256 f71f45e47114884fc7151939eb90f1ead59990d5ab79228364606efb2eede612
MD5 d3dda117d7ce7169cd4eee93e25ba9d6
BLAKE2b-256 f1a3d3909ab54e0a38d4763a352463a998e6ccd4057505b916cf732fbc5394a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidpipe-1.0.2.tar.gz:

Publisher: pypi.yml on HectorTablero/rapidpipe

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

File details

Details for the file rapidpipe-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: rapidpipe-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 36.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rapidpipe-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1116ee83a2e361727498da55c15a3930dbb3f3816d6c432fe854179afb3ea26b
MD5 7ff8651e272289e448929893507611bd
BLAKE2b-256 6d3a560726bb3556f0eb49bab3ca7f8aa71d45a871f0dbe88cf531227b24dbf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidpipe-1.0.2-py3-none-any.whl:

Publisher: pypi.yml on HectorTablero/rapidpipe

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