https://github.com/willguimont/pipeline
Lightweight pipeline library
https://github.com/willguimont/pipeline
arrow functional-programming lambda pipeline python
Last synced: about 1 month ago
JSON representation
Lightweight pipeline library
- Host: GitHub
- URL: https://github.com/willguimont/pipeline
- Owner: willGuimont
- License: mit
- Created: 2021-09-08T14:13:47.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-06T00:17:16.000Z (over 2 years ago)
- Last Synced: 2025-04-05T03:02:44.547Z (7 months ago)
- Topics: arrow, functional-programming, lambda, pipeline, python
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pipeline
Some transforms utilities based on `Arrows` from Haskell.
# Installation
Add the following line in your `requirements.txt`:
```
git+https://github.com/willGuimont/pipeline
```
# Usage
```python
import pipeline as pp
input_value = 7
transform = pp.Compose([
pp.Tee(),
pp.First(lambda x: x + 1),
pp.Second(lambda x: x - 1),
pp.Both(lambda x: x * 2),
pp.Bifunctor(lambda x: x // 3, lambda x: x * 2),
pp.Both(str),
pp.Lambda(lambda x: ''.join(x))
])
output = transform(input_value)
print(output)
assert output == "524"
```