pipef: Function Pipelines for Python¶
What is pipef?¶
pipef is a small, dependency-free library that chains callables with | instead of nesting
them. One | operator covers two shapes: a reusable lazy function built once and called later, and
an eager pipeline that pipes a value through immediately
pipef works as a double pun — pipe + function, but also pipe + forked, since each | in lazy mode
forks a new immutable chain instead of mutating the old one
Linux, macOS, and Windows are all first-class citizens, and so is every Python from 3.8 up
Why Use pipef¶
See Comparison for the full survey against pipetools, toolz, sspipe, and
others — in short:
One operator, two shapes: the same
|builds a reusable lazy function (pipef | f | g) or pipes a value eagerly (pipef(x) | f | g), instead of needing a different library for eachZero dependencies: nothing else installs alongside it
Shared computation in eager mode: branching off an already-resolved eager chain reuses that prefix’s result instead of recomputing it per branch
Multi-arg/kwarg seed:
pipef(1, 2, c=3) | fseeds a chain with more than one value up front, which nothing surveyed in the comparison does
None of this is a reason to migrate off a library that’s already working for you — pipef is aimed
at new code, or a project that wants both shapes without importing two libraries to get them
Key Features¶
Lazy function factory:
pipef | f | gbuilds a reusable, forkable functionEager value pipeline:
pipef(x) | f | gapplies each step immediately and hands back a resultImmutable forking: piping further off any chain, lazy or eager, always returns a fresh
pipefand leaves the original callable and unchangedTyped and dependency-free: ships
py.typed, works on Python 3.8 through 3.14, and pulls in nothing else
Quick Start¶
Installation¶
pip install pipef
See Installing pipef for uv, Poetry, and Pipenv equivalents
Basic Usage¶
from pipef import pipef
fn = pipef | add_2 | mult_3
fn(2)
> 12
See Quick Start Guide for a slightly longer walkthrough, Advanced Usage for the full lazy/eager reference, or API Reference for the generated class docs