Slurry
An async stream processing microframework for Python
Introduction
Slurry builds on the concepts of structured concurrency and memory channels, originating in Trio, and uses them to create a microframework for processing streaming data.
The basic building blocks of Slurry includes:
Pipelines - An asynchronous context manager which encapsulates a stream process.
Sections - The individual processing steps.
Taps - Output channels for the processed stream.
Extensions - A way to add more processing steps to an existing pipeline.
Slurry avoids using asynchronous generator functions, in favor of the pull-push programming style of memory channels. It can be thought of as an asynchronous version of itertools - on steroids!
Included in the basic library are a number of basic stream processing building blocks, like Map, Chain, Merge and Zip, and it is easy to build your own!
Demonstration
Enough talk! Time to see what’s up!
async with Pipeline.create(
Zip(produce_increasing_integers(1, max=3), produce_alphabet(0.9, max=3))
) as pipeline, pipeline.tap() as aiter:
results = [item async for item in aiter]
assert results == [(0,'a'), (1, 'b'), (2, 'c')]
The example producers (which are not part of the framework) could look like this:
async def produce_increasing_integers(interval, *, max=3):
for i in range(max):
yield i
if i == max-1:
break
await trio.sleep(interval)
async def produce_alphabet(interval, *, max=3):
for i, c in enumerate(string.ascii_lowercase):
yield c
if i == max - 1:
break
await trio.sleep(interval)
Further documentation is available on readthedocs. Check out the source code on github.
Installation
Still here? Wanna try it out yourself? Install from PyPI:
pip install slurry
Slurry is tested on Python 3.8 or greater and requires the Trio concurrency and IO library.
License
Slurry is licensed under the MIT license.
Metadata
Release files for slurry 1.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| Slurry-1.3.1.tar.gz | 15.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Slurry-1.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.5 kB
Release files / Slurry-1.3.1.tar.gz
| Download URL | Slurry-1.3.1.tar.gz |
|---|---|
| Size | 15.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
38abbdbe8abc79204014ad2e81c0fee54c060f41af7bb3206d7862ef3cb2c47e
|
|
BLAKE2b-256 checksum How to use checksums |
65e4a5b710f331b02ddf07cf4e529d07c54f4e4817753349ad15cc3fd1f4b6ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.10.6 Linux/5.15.0-1017-azure
|
Release files / Slurry-1.3.1-py3-none-any.whl
| Download URL | Slurry-1.3.1-py3-none-any.whl |
|---|---|
| Size | 19.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7cab793a35c38dc3504399a2754e4fb8125877474c2ab96d0015be68ac6fae0
|
|
BLAKE2b-256 checksum How to use checksums |
baca6f197656ab63980f7ca1819bbd633a2c9c5e6c48dd8d681fdc255a1243f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.10.6 Linux/5.15.0-1017-azure
|
Security for slurry 1.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.