Skip to main content

Async component pipeline framework for data processing

Project description

Vectis

Async component pipeline framework for Python data processing

Vectis enables you to build data processing pipelines by defining components and connecting them via configuration. It supports in-process, multiprocess, and distributed execution modes with automatic transport selection.

Features

  • Component-Based Architecture: Define reusable DataProviders (sources) and Algorithms (processors/sinks)
  • YAML Configuration: Declare pipeline topology without code changes
  • Multiple Execution Modes: In-process, multiprocess, and distributed (ZMQ)
  • Flexible Distribution: Fan-out (broadcast) or competing (load-balanced) message routing
  • Type-Safe Configuration: Pydantic-based configuration validation
  • Graceful Shutdown: Proper lifecycle management with start/stop hooks

Installation

pip install pyvectis

With optional dependencies:

pip install pyvectis[msgpack]      # MessagePack serialization
pip install pyvectis[distributed]  # ZeroMQ for distributed execution
pip install pyvectis[all]          # All optional dependencies

Quick Start

1. Define Components

from pydantic import BaseModel
from vectis import DataProvider, Algorithm, Message, data_provider, algorithm

class CounterConfig(BaseModel):
    count: int = 10

@data_provider("counter")
class CounterProvider(DataProvider[CounterConfig]):
    async def run(self):
        for i in range(self.config.count):
            if self._stop_requested:
                break
            await self.send_data({"value": i})
        await self.send_end_of_stream()

@algorithm("printer")
class PrinterAlgorithm(Algorithm):
    async def on_received_data(self, message: Message):
        print(f"Received: {message.payload}")

2. Create Configuration

# pipeline.yaml
global:
  name: my-pipeline

data_providers:
  - name: counter
    type: counter
    config:
      count: 5

algorithms:
  - name: printer
    type: printer

connections:
  - source: counter
    targets: [printer]

3. Run the Pipeline

import asyncio
from vectis import Engine

async def main():
    engine = Engine("pipeline.yaml")
    await engine.run()

asyncio.run(main())

Output:

Received: {'value': 0}
Received: {'value': 1}
Received: {'value': 2}
Received: {'value': 3}
Received: {'value': 4}

Examples

The examples/ directory contains complete, runnable examples:

Run an example:

python -m examples.simple_pipeline.run

Key Concepts

Components

  • DataProvider: Generates data (sources). Implements run() method.
  • Algorithm: Processes data (sinks/processors). Implements on_received_data().

Distribution Modes

  • fan_out: Every message goes to ALL targets (broadcast)
  • competing: Each message goes to ONE target (load-balanced)

Transport Types

Vectis automatically selects transport based on component placement:

Scenario Transport Performance
Same process INPROCESS Fastest
Same host, different process MULTIPROCESS Fast
Different hosts DISTRIBUTED (ZMQ) Network-bound

Use force_inprocess=True to debug distributed pipelines locally:

await engine.run(force_inprocess=True)  # Run everything in one process

Documentation

Development

# Clone the repository
git clone https://github.com/farriolsartur/vectis.git
cd vectis

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# Run specific test file
pytest tests/test_examples.py -v

Requirements

  • Python 3.10+
  • pydantic >= 2.0
  • pyyaml >= 6.0

Optional:

  • msgpack >= 1.0 (for MessagePack serialization)
  • pyzmq >= 25.0 (for distributed execution)

License

MIT License - see LICENSE for details.

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

pyvectis-0.1.0.tar.gz (54.7 kB view details)

Uploaded Source

Built Distribution

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

pyvectis-0.1.0-py3-none-any.whl (76.4 kB view details)

Uploaded Python 3

File details

Details for the file pyvectis-0.1.0.tar.gz.

File metadata

  • Download URL: pyvectis-0.1.0.tar.gz
  • Upload date:
  • Size: 54.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for pyvectis-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bba216cec6675ca98e85d05c4933fcdcc697d85fe16768bc9c6a99ab6cced301
MD5 0a7e79b6b566f0fe408eb4fb6ffae812
BLAKE2b-256 d291ce1445239fd426234192af7016de66e7c2796fc531e695163f8b4089abbb

See more details on using hashes here.

File details

Details for the file pyvectis-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyvectis-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 76.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for pyvectis-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d87bcf1ab5d89d415ba1c00242706bfb57fefbca9403beee8909087cb008950b
MD5 23d91bd00d4704f7aef7d54a634a15e9
BLAKE2b-256 d3c40c209edbf81e74a14353b1e3f4afad9ec428015a62e8d95eb20eae8b25be

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