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 pipeVerified import paths — ran on the pinned version, not inferred.
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.
Wrap the final piped result in `list()`, `tuple()`, `set()`, or iterate over it: `final_list = list(my_iterable | op1 | op2)`.
Always use `my_list | function_name(...)` instead of `my_list | .function_name(...)` or `my_list.function_name(...)`. Ensure you import the specific functions.
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(...)`.
Add the necessary import statement: `from pipe import select` (or the specific function you are using).
Ensure the initial object being piped is an iterable. If you have a single value, wrap it in a list: `[my_int] | select(...)`.
Call `list()`, `tuple()`, `set()`, `next()`, or iterate over the result to force evaluation: `final_data = list(initial_data | op1 | op2)`.
No dependency data recorded yet.