Sprig
raw JSON → 0.5.1 verified Sat May 09 auth: no python
Sprig is a Python library providing a collection of miscellaneous utilities that don't fit neatly elsewhere, often used for functional programming helpers (like composition and chaining). Version 0.5.1 is the latest release, with no regular cadence; the project is in early development.
pip install sprig Common errors
error ModuleNotFoundError: No module named 'sprig' ↓
cause Sprig is not installed.
fix
Run 'pip install sprig'.
error AttributeError: module 'sprig' has no attribute 'curry' ↓
cause 'curry' was removed or deprecated after upgrade.
fix
Use 'functools.partial' instead, or if on older version pin to sprig==0.4.x.
Warnings
breaking Version 0.5.0 removed previously deprecated functions. Check your imports if upgrading from <0.5.0, as many utility functions (e.g., 'flip', 'placeholder') were removed without alias. ↓
fix Replace removed imports with alternatives or vendor the code.
deprecated The 'curry' function is deprecated in 0.5.0 and may be removed in a future release. ↓
fix Use 'functools.partial' or manual currying instead.
gotcha The library is unstable and not intended for production use. Expect frequent breaking changes between minor versions. ↓
fix Pin to exact version and test thoroughly on upgrade.
Imports
- compose
from sprig import compose - identity
from sprig import identity - pipe
from sprig import pipe
Quickstart
from sprig import compose, pipe
add_one = lambda x: x + 1
square = lambda x: x * x
add_then_square = compose(square, add_one)
result = add_then_square(5) # 36
print(result)