Skip to main content

Python signal based flow based programming

Project description


This library provides utilities that allow to build simple signal / generator
based data flows which provide for clean code on complex data transformations.

This was primarily designed to be used in batch works though, in principle,
streaming data should work just fine.

And it was born because I needed something *really* simple that would allow me
to process data on a row-by-row basis and generate events/signals during that
processing.

## Usage example (see tests/)

```python
from signalflow import Pipe, Plumber


class EmitZeroThenOne(Pipe):
def once(self):
# once is called when the loop has nothing to do and is looking
# for new signals.
self.emit_number(0)
self.emit_number(1)

def emit_number(self, i: int):
# emit_* are always stubs.
pass


class FibonacciAcummulator(Pipe):
last_number = -1

def receive_number(self, sender, i: int):
if i > 34:
return
if self.last_number >= 0:
self.emit_number(i + self.last_number)
self.last_number = i

def emit_number(self, i: int):
pass


class NumberPrinter(Pipe):
def receive_number(self, sender, i: int):
print(f"Received {i}")


flow = Plumber()
flow.add_pipe(EmitZeroThenOne())
flow.add_pipe(FibonacciAcummulator())
flow.add_pipe(NumberPrinter())

flow.go() # Prints Fibonacci Sequence
```

Keywords: flow signal datapipe pipe development
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Description-Content-Type: text/markdown
Provides-Extra: dev
Provides-Extra: test

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for signalflow, version 0.0.1
Filename, size & hash File type Python version Upload date
signalflow-0.0.1-py3.6.egg (5.4 kB) View hashes Egg 3.6
signalflow-0.0.1.tar.gz (4.9 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page