Reactive Dataflow Graphs
Project description
Reactive-Dataflow
Reactive Processing Graphs for Python.
Getting Started
Installation
pip install reactivedataflow
The key dependencies for this project include rx
and networkx
. These are outlined in the pyproject.toml
dependencies section.
Usage
import reactivex as rx
from reactivedataflow import (
GraphAssembler,
GraphModel,
VerbNodeModel,
InputNodeModel,
InputModel,
verb,
InputPort,
ConfigPort
)
#
# Define a processing verb
#
@verb(
name="print",
ports=[
InputPort(name="values", required=True, parameter="val"),
ConfigPort(name="prefix", required=False, parameter="prefix"),
]
)
def print_verb(val, prefix=""):
return f"{prefix}{val}"
#
# Define a simple graph
#
assembler = GraphAssembler()
assembler.load(
GraphModel(
inputs=[
# This is an input stream of values we'll define on build
InputNodeModel(id="input_values")
],
nodes=[
# Here we define the processing nodes
VerbNodeModel(
id="verb1",
verb="print",
config={"prefix": "emitted: "},
input={
"values": InputModel(node="input_values")
}
),
],
),
)
#
# Build the graph and bind input streams
#
graph = assembler.build(
inputs={
"input_values": rx.of([1, 2, 3])
}
)
#
# Watch graph outputs
#
graph.output("verb1").subscribe(print)
# Output:
# emitted: 1
# emitted: 2
# emitted: 3
Developing
This project uses poetry
for dependency management. You should have a recent Python version (e.g. 3.10+) and Poetry 1.8+ installed on your system.
# Install dependencies
poetry install
# Run tests
poetry run poe test
# Run static checks
poetry run poe check
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
reactivedataflow-0.1.1.tar.gz
(13.1 kB
view details)
Built Distribution
File details
Details for the file reactivedataflow-0.1.1.tar.gz
.
File metadata
- Download URL: reactivedataflow-0.1.1.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24967ce943b074cb978f8e35e373ba200908511233e67582ac62674aa1f86722 |
|
MD5 | 8db4754e30e1344c98ba29c820a2b477 |
|
BLAKE2b-256 | 8f11189214c79ecb1bb58cf6085a57f141054282c5fb940e559b62ab5ae84903 |
File details
Details for the file reactivedataflow-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: reactivedataflow-0.1.1-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e2e9abb58c7e1e3087e8593dc9a1c9a37cab8c97ed5e93cff5f3e9f694d8453 |
|
MD5 | b68c95a637fe5b4dee5dfcf885ccaf94 |
|
BLAKE2b-256 | 6f14679d5520a48e60409423baa9acceac74606e0f260b87fb6fc37b80abe119 |