Skip to main content

Functional Pipeline

PyPI version pipeline status coverage report PyPI Documentation Status

Functional languages like Haskell, Elixir, and Elm have pipe functions that allow the results of one function to be passed to the next function.

Using functions from functools, we can build composition in python, however it is not nearly as elegant as a well thought out pipeline.

This library is designed to make the creation of a functional pipeline easier in python.

>>> from operator import add, mul

>>> from functional_pipeline import pipeline, tap

>>> result = pipeline(
...     10,
...     [
...         (add, 1),
...         (mul, 2)
...     ]
... )

>>> result
22

This pattern can be extended for easily dealing with lists or generators.

>>> from functional_pipeline import pipeline, String, join

>>> names = [
...     "John",
...     "James",
...     "Bill",
...     "Tiffany",
...     "Jamie",
... ]

>>> result = pipeline(
...     names,
...     [
...         (filter, String.startswith('J')),
...         (map, lambda x: x + " Smith"),
...         join(", "),
...     ]
... )

>>> result
'John Smith, James Smith, Jamie Smith'

Metadata

Release files for functional-pipeline 0.6.1

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

Built distribution (wheel)

Table of built distributions (wheels) for functional-pipeline 0.6.1
File Interpreter ABI Platform
functional_pipeline-0.6.1-py3-none-any.whl Python 3 none any Details

Release files / functional_pipeline-0.6.1-py3-none-any.whl

Download URL functional_pipeline-0.6.1-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cdda3bccfb42cfc6393ae3e895a196e6f7041d80d698748403406a81d70cba22
BLAKE2b-256 checksum
How to use checksums
095c1315e5b1f498c953fbf3c20e17c1bbfb5fefcc648bc46638ef64d58d7f97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.6.1 This release

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

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