Skip to main content

pipeline

This package is inspired by Elixirs pipelines. You can define an interable of callables and define them as pieline. The second element then gets the result of the first element and so on.

Example

Say you have some callables (see test/test_pipeline.py):

def add_age(item):
    item.age = 22
    return item

def add_name(name):
    def fun(item):
        item.name = name
        return item
    return fun

class AddHeight:

    def __init__(self, height):
        self.height = height

    def __call__(self, item):
        item.height = 192
        return item

Then you can compose them to a pipeline:

def some_name(arg):
    return pipeline(
        arg,
        add_age,
        inspect,
        add_name('Tom'),
        inspect(print),
        AddHeight(192),
    )

And use it as one:

class Plain:
    pass

plain_obj = Plain()
res = some_name(plain_obj)

assert res.age == 22
assert res.name == 'Tom'
assert res.height == 192

Inspect

For debugging, it is quite useful to inspect the intermediate result between two steps in the pipeline. This is easy with inspect:

def some_name(arg):
    return pipeline(
        arg,
        add_age,
        inspect,
        add_name('Tom'),
        inspect(print),
        AddHeight(192),
    )

Note that you can just use inspect, which usese pprint as default printer or pass a custom method in to print.

Metadata

Release files for easy-pipeline 0.0.1

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

Source distribution (sdist)

Source distribution for easy-pipeline 0.0.1
File Size Uploaded Provenance
easy-pipeline-0.0.1.tar.gz 6.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for easy-pipeline 0.0.1
File Interpreter ABI Platform
easy_pipeline-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.8 kB

Release files / easy-pipeline-0.0.1.tar.gz

Download URL easy-pipeline-0.0.1.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
840007b921428b07f1f8cb5db06b1021537fb70354b6abca28bcff793e620429
BLAKE2b-256 checksum
How to use checksums
83121584ffcabed7cb1296f61719cb45a2c358add733471e1c10010eb819e7aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

Release files / easy_pipeline-0.0.1-py3-none-any.whl

Download URL easy_pipeline-0.0.1-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18bb85f0a8aba8e9d53f1f97f18dbceb35c8b0b3d86862b54f133be9f97044c4
BLAKE2b-256 checksum
How to use checksums
cf28738b7100b721e3e4bf138a1f7d0a8da2c9fa3fe296a531b5368f872d5d35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

Security for easy-pipeline 0.0.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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No 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