minpipe
minpipe is a minimal library for building one-off concurrent data pipelines in python. It was inspired by pypeln.
Example
import numpy as np
from minpipe import Pipeline, Signal, Stage
def make_random_data():
x = np.random.randn(10, 10, 10000)
def random_data():
for xi in x:
yield xi
yield Signal.STOP
return random_data
def mean(xi):
yield np.mean(xi, axis=-1)
def flatten(means):
for m in means:
yield m
def filter_pos(m):
if m > 0:
yield m
def printout(m):
print(f"mean={m:.2f}")
pipeline = Pipeline(
Stage(make_random_data()),
Stage(mean, num_workers=2),
Stage(flatten, num_workers=1),
Stage(filter_pos),
Stage(printout),
)
# serial debug run
# pipeline.serial(max_items=10)
pipeline.start()
pipeline.join()
Installation
pip install minpipe
See also
Licence
MIT
Metadata
Release files for minpipe 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| minpipe-0.1.0.tar.gz | 4.7 kB | Details |
Release files / minpipe-0.1.0.tar.gz
| Download URL | minpipe-0.1.0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07df6e7ca4dfef74e0f7d904f67a3e32ae4ecde5e3d8b327c252a74c74b3a4a2
|
|
BLAKE2b-256 checksum How to use checksums |
44323ee148bca06dba5d6e809184e7e9d64afbc09b67ed979e0a16b817abd861
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.4 tqdm/4.59.0 importlib-metadata/3.10.0 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.7.10
|