Streamline your stream processing.
Project description
Slipstream
Slipstream provides a data-flow model to simplify development of stateful streaming applications.
pip install slipstream-async
from asyncio import run
from slipstream import handle, stream
async def messages():
for emoji in '🏆📞🐟👌':
yield emoji
@handle(messages(), sink=[print])
def handle_message(msg):
yield f'Hello {msg}!'
if __name__ == '__main__':
run(stream())
Hello 🏆!
Hello 📞!
Hello 🐟!
Hello 👌!
Usage
Async iterables
are sources, (async) callables
are sinks.
Decorate handler functions using handle
, then run stream
to start processing:
Multiple sources and sinks can be provided to establish many-to-many relations between them.
The 4 emoji's were printed using the callable print
.
Quickstart
Install aiokafka
(latest) along with slipstream:
pip install slipstream-async[kafka]
Spin up a local Kafka broker with docker-compose.yml, using localhost:29091
to connect:
docker compose up broker -d
Follow the docs and set up a Kafka connection: slipstream.readthedocs.io.
Features
slipstream.handle
: bind streams (iterables) and sinks (callables) to user defined handler functionsslipstream.stream
: start streamingslipstream.Topic
: consume from (iterable), and produce to (callable) kafka using aiokafkaslipstream.Cache
: store data to disk using rocksdictslipstream.Conf
: set global kafka configuration (can be overridden per topic)slipstream.codecs.JsonCodec
: serialize and deserialize json messages
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
Built Distribution
File details
Details for the file slipstream_async-0.0.1a0.tar.gz
.
File metadata
- Download URL: slipstream_async-0.0.1a0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b562338379095b91b6e02c19274f4cf87dc0ff71113fc07d328f9c683c7e94f |
|
MD5 | f9992e5bded10bf81ba6fac665d02678 |
|
BLAKE2b-256 | 833e81ebf70065fb508a00950eb0978be10c4998c2432289a75f2414cbf716f3 |
File details
Details for the file slipstream_async-0.0.1a0-py3-none-any.whl
.
File metadata
- Download URL: slipstream_async-0.0.1a0-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c30ad478a019b5cac990affcc2cc8a7083f7e7f772ddf28b9e1fdb518b718d17 |
|
MD5 | 603fe5eabe048e0048abcf901c7fa607 |
|
BLAKE2b-256 | 1783891e264f838cc045eea472f1e2960c0482588b03198227888649aa06e054 |