Registry / data / pipe
library2.2pypypi✓ verified 84d ago

The `pipe` library enables a shell-like infix syntax in Python, allowing users to chain operations on iterables using the pipe (`|`) operator. It provides a functional programming style for data processing, similar to LINQ in C# or shell pipes. The current stable version is 2.2, and it follows a slow but steady release cadence, focusing on stability given its utility nature.

pip install pipe
INSTALL
IMPORT
SIG · PIPE
P
pipe
datapythonv2.2
Install
1.6s avg
Import
10ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.011s · 17.8MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.6s · import 0.010s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

select
from pipe import select
where
from pipe import where
take
from pipe import take

This quickstart demonstrates chaining `where` (filter), `select` (map), and `take` (limit) operations on a list using the pipe syntax. It highlights that `pipe` operations are lazy and return generators, which must be explicitly consumed (e.g., by `list()`) to obtain concrete results.

from pipe import select, where, take l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # Chain operations: filter even numbers, double them, take the first 3 result = l | where(lambda x: x % 2 == 0) | select(lambda x: x * 2) | take(3) # The result is a generator; convert to list to see concrete values final_list = list(result) print(final_list)
Debug
Known issues
gotchaPipe operations are lazy and return generators. To get a concrete result (e.g., a list or a single value), you must explicitly consume the generator.
fix
Wrap the final piped result in `list()`, `tuple()`, `set()`, or iterate over it: `final_list = list(my_iterable | op1 | op2)`.
affects: All versions
gotchaThe `pipe` library functions (e.g., `select`, `where`) are standalone functions that receive the iterable via the pipe operator, not methods of the iterable itself.
fix
Always use `my_list | function_name(...)` instead of `my_list | .function_name(...)` or `my_list.function_name(...)`. Ensure you import the specific functions.
affects: All versions
gotchaPiped operations work on iterables. Passing a non-iterable (like an integer) as the initial input or at any point in the chain where an iterable is expected will raise a TypeError.
fix
Ensure the left-hand side of each pipe operation (`|`) is an iterable. For single values, you might wrap them in a list or tuple: `[value] | select(...)`.
affects: All versions
Errors
Common errors & fixes
NameError: name 'select' is not defined
Attempting to use a `pipe` function (like `select`, `where`, `take`) without explicitly importing it from the `pipe` module.
fix
Add the necessary import statement: `from pipe import select` (or the specific function you are using).
TypeError: unsupported operand type(s) for |: 'int' and 'function'
Trying to apply a pipe operation to a non-iterable object, such as an integer, instead of a list, tuple, or generator.
fix
Ensure the initial object being piped is an iterable. If you have a single value, wrap it in a list: `[my_int] | select(...)`.
(No output/empty result when expected)
The `pipe` operations return generators, which are lazy. If you don't explicitly consume the generator, you won't see any concrete results or side effects.
fix
Call `list()`, `tuple()`, `set()`, `next()`, or iterate over the result to force evaluation: `final_data = list(initial_data | op1 | op2)`.
Upgrade
Version history
2.2latest on PyPI · released Apr 4, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
pipe — pip install pipe · libregistry