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.4.tar.gz (35.9 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.4-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rapidpipe-1.0.4.tar.gz
  • Upload date:
  • Size: 35.9 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.4.tar.gz
Algorithm Hash digest
SHA256 68a20aa342d85578a8fa07e2b3fc71a817961cab55b9904c149c8ed17fa658e1
MD5 be347556df20e47ebb4556f07ca5ff1c
BLAKE2b-256 d49f88b71f2dcdbd43658e1ac53e75199be214549dc794d39a5c524c85ad55c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidpipe-1.0.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: rapidpipe-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 40.6 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a353c4194fe148bcacc4f6dab5663f2adea26bf85b3c004f6451ff6fdbc080a0
MD5 8e0c4b23c87e74c0d5dd2bcf9d54c7f7
BLAKE2b-256 57c0727a4a51bbf323ab4db3742b7e78b0d1b720dc14ad82afd92971cb5fe24d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidpipe-1.0.4-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