Skip to main content

An async stream processing microframework

Project description

Documentation Status Latest PyPi version Build Status

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 = []
         async for item in aiter:
             results.append(item)
         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.6 or greater. For now, Slurry is Trio only. AnyIO support is not ruled out in the future.

License

Slurry is licensed under the MIT license.

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

Slurry-0.3.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Slurry-0.3.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file Slurry-0.3.0.tar.gz.

File metadata

  • Download URL: Slurry-0.3.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.8.0 Linux/4.15.0-1077-gcp

File hashes

Hashes for Slurry-0.3.0.tar.gz
Algorithm Hash digest
SHA256 26c5597358210ef9434caf77eaa7c9803a0e33e43e82eee3a38cfec5df3dea1a
MD5 829c8ee2e1b2d59d2959cbf81e860d3b
BLAKE2b-256 cb4a79cff102d03a21d8a297f0a6fd789673a2c02c8c9f8908b8b74b1054a250

See more details on using hashes here.

File details

Details for the file Slurry-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: Slurry-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.8.0 Linux/4.15.0-1077-gcp

File hashes

Hashes for Slurry-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99de5d8fb55705227acf83691b6b6e0edad50c3817ef984fd2edbed0e6415ff6
MD5 ca0275158f331f0e32ec02472940bd4c
BLAKE2b-256 cd727f369c1745f22c2c62cda89979f21ba81d3d2193e0120ebec6ef47d444d5

See more details on using hashes here.

Supported by

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