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.16.tar.gz
(19.9 kB
view details)
Built Distribution
File details
Details for the file reactivedataflow-0.1.16.tar.gz
.
File metadata
- Download URL: reactivedataflow-0.1.16.tar.gz
- Upload date:
- Size: 19.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bcd7b12988618a7b2940ba0804b7e56a14f4b76930200861d6067315830e534 |
|
MD5 | cc1d103c690a3493a1b6f54134bafb46 |
|
BLAKE2b-256 | 17c5d8c6f38b03c9d4ce2a48a0147e68e5b8dcec2bdc7810bc39f00a6c704c19 |
File details
Details for the file reactivedataflow-0.1.16-py3-none-any.whl
.
File metadata
- Download URL: reactivedataflow-0.1.16-py3-none-any.whl
- Upload date:
- Size: 31.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69bb45cb74a1ba2d54a4cc24dcc4404c2bcf1af1883fa89330feec1072fbfa20 |
|
MD5 | b78c409bf3016ef4c877d99b5ed3cc97 |
|
BLAKE2b-256 | 096661304cf17896e54b0f62d277d590e09b763472f68685fd424eecad8224c6 |