Skip to main content

CI status PyPI version Python 3.10+ MIT License
English | Türkçe

FlowPipeline

Repository · Changelog · MIT License

Composable processing stages and async streams for Python applications. Define a sequence of transformations and run it synchronously or asynchronously.

Contents

Getting started

Install

Install from the project root with Python 3.10 or later.

python -m pip install .

Run named stages in order

Each stage receives the previous stage’s result. Register functions with a decorator or add existing callables by name.

from flowpipeline import Pipeline

pipeline = Pipeline[str]()


@pipeline.stage("trim")
def trim(value: str) -> str:
    return value.strip()


pipeline.add("normalize", str.lower)
assert pipeline.run("  Ready  ") == "ready"

Core concepts

Choose Pipeline for synchronous stages and AsyncPipeline for coroutine stages. Use AsyncStream when input arrives as a stream or needs incremental processing with bounded buffering.

Pipelines and middleware

Wrap execution and collect measurements

Middleware can run code around the remaining stages. Here it supplies a default value before normalizing the input, while the observer records the run.

from flowpipeline import Pipeline, PipelineStats

stats = PipelineStats()
pipeline = Pipeline[str](observer=stats)
pipeline.add("normalize", str.lower)


@pipeline.middleware("default")
def supply_default(value, next_):
    return next_(value or "UNKNOWN")


assert pipeline.run("") == "unknown"
assert stats.snapshot.runs.successful == 1

Async pipelines and streams

Process items and consume them in batches

A stream consumes input incrementally. It can apply an async pipeline to each item, filter the results, and group the remaining items into batches.

import asyncio

from flowpipeline import AsyncPipeline, AsyncStream


async def source():
    for value in range(4):
        yield value


async def main() -> None:
    pipeline = AsyncPipeline[int]()

    @pipeline.stage("double")
    async def double(value: int) -> int:
        return value * 2

    stream = AsyncStream(source()).map(pipeline.run).filter(lambda value: value > 0).batch(2)
    async with stream:
        assert [batch async for batch in stream] == [(2, 4), (6,)]


asyncio.run(main())

Use batch(size) to group by count. Use batch_within(size, delay) when a partial batch needs a deadline. Add buffer(capacity) when the producer and consumer can benefit from running independently. Buffering adds a queue handoff, which can cost more than it saves for an in-memory source and a fast consumer.

Development and license

python -m pip install -e ".[dev]"
python run_tests.py

This project is licensed under the MIT License.

FlowEvent · FlowCoord

Metadata

Release files for flowpipeline 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flowpipeline 1.0.0
File Size Uploaded Provenance Actions
flowpipeline-1.0.0.tar.gz 31.2 kB With provenance Details for flowpipeline-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flowpipeline 1.0.0
File Interpreter ABI Platform Actions
flowpipeline-1.0.0-py3-none-any.whl Python 3 none any Details for flowpipeline-1.0.0-py3-none-any.whl

Total release size: 50.7 kB

Release files / flowpipeline-1.0.0.tar.gz

Download URL flowpipeline-1.0.0.tar.gz
Size 31.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ea2ec01ac1432a81f3a6d0b6f61e02327c91ef20dc42158f9e225de033882147
BLAKE2b-256 checksum
How to use checksums
a84949828cc644f4a55053eb476fcdc2390cf05c8b864778600e52f1f50039b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / flowpipeline-1.0.0-py3-none-any.whl

Download URL flowpipeline-1.0.0-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30f86b71a1d64fd040577b074f5a58c60f9c0bce756877d03bfbbf0eee2aba14
BLAKE2b-256 checksum
How to use checksums
c22ee4461abb421a24a8b147fca13270fb75ac3d396b25b31d98b2907f4ba9a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for flowpipeline 1.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for flowpipeline-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page