Skip to main content

codeupipe

codeupipe is a Python library for writing a program as a pipeline of small steps. It has no dependencies. Python 3.9 or later.

pip install codeupipe

The eight primitives

Primitive What it does Who writes it
Payload Carries the data The library
Filter Changes the data You
Predicate Asks a yes-or-no question about the data You
Valve Joins a Predicate to a Filter: the Filter runs when the answer is yes The library. You add one with add_valve(predicate, filter)
Tap Reads the data as it goes by You
Hook Is called before and after each step You
State Records which steps ran The library
Pipeline Runs the steps in order You

Example

Each class is in its own file. The pipeline file imports them and adds them.

# discount_filter.py
class DiscountFilter:
    def __init__(self, rate):
        self.rate = rate

    def call(self, payload):
        return payload.insert("price", round(payload.get("price", 0) * (1 - self.rate), 2))
# at_least_predicate.py
class AtLeastPredicate:
    def __init__(self, key, minimum):
        self.key = key
        self.minimum = minimum

    def test(self, payload):
        return payload.get(self.key, 0) >= self.minimum
# pricing_pipeline.py
from codeupipe import Pipeline

from .at_least_predicate import AtLeastPredicate
from .audit_tap import AuditTap
from .discount_filter import DiscountFilter
from .mark_bulk_filter import MarkBulkFilter


class PricingPipeline(Pipeline):
    def __init__(self):
        super().__init__()
        self.add_filter(DiscountFilter(0.1))
        # MarkBulkFilter runs only when the predicate is true.
        self.add_valve(AtLeastPredicate("qty", 10), MarkBulkFilter())
        # A Tap failure is recorded and does not stop the run.
        self.add_tap(AuditTap())
from codeupipe import Payload

PricingPipeline().run(Payload({"price": 100.0, "qty": 12})).to_dict()
# {'price': 90.0, 'qty': 12, 'bulk': True}

A step must be a class in a module. A lambda is refused, because a step is identified by its type, and State, Hooks and the export use that identity.

What is in the package

  • codeupipe: the eight primitives.
  • python -m codeupipe.lower: writes a pipeline as plain Python with no import of codeupipe.
  • codeupipe.config: reads cup.config.json.

The linter is a separate package: pip install codeupipe-lint.

Documentation

License

Apache License 2.0.

Metadata

Release files for codeupipe 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 codeupipe 1.0.0
File Size Uploaded Provenance
codeupipe-1.0.0.tar.gz 42.7 kB With provenance Details

Built distribution (wheel)

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

Total release size: 97.6 kB

Release files / codeupipe-1.0.0.tar.gz

Download URL codeupipe-1.0.0.tar.gz
Size 42.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c7244b5631a17dbf7d3236acfae435b765f7b5be1e19f6305e769b32af3821d8
BLAKE2b-256 checksum
How to use checksums
301d32184b88442edbb99d10e06cd6026d23e9d0dfa478dbaaf241da3eb5a93d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 10, 2026.

Transparency log

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

Download URL codeupipe-1.0.0-py3-none-any.whl
Size 54.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5149d2e4b6f77557978656f29123666022529f7e01bd700d4961ed02f5764170
BLAKE2b-256 checksum
How to use checksums
9e1b43db2762c4cb70783e27135e526f2851b8dc122a207e1842ecd36b9fe621
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 10, 2026.

Transparency log

Security for codeupipe 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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for codeupipe-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 Oct 10, 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.

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