Skip to main content

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


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.10.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

reactivedataflow-0.1.10-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file reactivedataflow-0.1.10.tar.gz.

File metadata

  • Download URL: reactivedataflow-0.1.10.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for reactivedataflow-0.1.10.tar.gz
Algorithm Hash digest
SHA256 1e2c3d673b4325521c6489f33e59a63f0d05c08570e1f9de326412d6046d93e2
MD5 f893496338d924374ef9c0362dcedf9a
BLAKE2b-256 e715fc56d6d9bb0d0c3edab9166c4f1631f22b7f1d809c68d25b653de6acacef

See more details on using hashes here.

File details

Details for the file reactivedataflow-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for reactivedataflow-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 e3e19a85663ab1685d2cc13b60e48605acbe12601a84fc310d1f6c88045bfa6f
MD5 00fe3fdba3910ffe879613f8a2c34bc4
BLAKE2b-256 68a5d940a0e8cf1c80e8a064b634beb604310db88530c4f91b63d630f7d777db

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page