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.5.tar.gz
(17.0 kB
view details)
Built Distribution
File details
Details for the file reactivedataflow-0.1.5.tar.gz
.
File metadata
- Download URL: reactivedataflow-0.1.5.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1abd979723f0f28bc7c1d011d21ea6d6afb62f7677ce7e1a37332c0b55dc5a47 |
|
MD5 | 5d6120fbdb573fa16c9d7cd397ede3fc |
|
BLAKE2b-256 | f2c2f85fd8eb38e5b2d72678852f088870eacbf78c0335c0696ec5af6179bbc9 |
File details
Details for the file reactivedataflow-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: reactivedataflow-0.1.5-py3-none-any.whl
- Upload date:
- Size: 27.5 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 | 37f6dc0d7753c4b155285d988c25e5c215df8b3a9a7368d0ae2a1847f0bcc73f |
|
MD5 | d363b5d2ebe95bd1a74a6a021526fb6e |
|
BLAKE2b-256 | 70184339d1bedf41f584f0c6bd80e26a993c1969b4f87ce7dd8047e3b916ebd7 |