{"id":10040,"library":"pipe","title":"Python Pipe Library","description":"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.","status":"active","version":"2.2","language":"python","source_language":"en","source_url":"https://github.com/JulienPalard/Pipe","tags":["functional programming","pipeline","infix syntax","iterators","data processing"],"install":[{"cmd":"pip install pipe","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"select","correct":"from pipe import select"},{"symbol":"where","correct":"from pipe import where"},{"symbol":"take","correct":"from pipe import take"}],"quickstart":{"code":"from pipe import select, where, take\n\nl = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n# Chain operations: filter even numbers, double them, take the first 3\nresult = l | where(lambda x: x % 2 == 0) | select(lambda x: x * 2) | take(3)\n\n# The result is a generator; convert to list to see concrete values\nfinal_list = list(result)\n\nprint(final_list)","lang":"python","description":"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."},"warnings":[{"fix":"Wrap the final piped result in `list()`, `tuple()`, `set()`, or iterate over it: `final_list = list(my_iterable | op1 | op2)`.","message":"Pipe 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always use `my_list | function_name(...)` instead of `my_list | .function_name(...)` or `my_list.function_name(...)`. Ensure you import the specific functions.","message":"The `pipe` library functions (e.g., `select`, `where`) are standalone functions that receive the iterable via the pipe operator, not methods of the iterable itself.","severity":"gotcha","affected_versions":"All versions"},{"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(...)`.","message":"Piped 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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'2.2':49 'allow':16 'c':40 'cadenc':58 'chain':19 'current':45 'data':34,72 'enabl':7 'focus':59 'follow':52 'function':30,66 'given':62 'infix':12,69 'iter':22,71 'librari':3,6 'like':11 'linq':38 'natur':65 'oper':20,26 'pipe':2,5,25,43 'pipelin':68 'process':35,73 'program':31,67 'provid':28 'python':1,15 'releas':57 'shell':10,42 'shell-lik':9 'similar':36 'slow':54 'stabil':61 'stabl':46 'steadi':56 'style':32 'syntax':13,70 'use':23 'user':17 'util':64 'version':47","created_at":"2026-04-17T01:22:03.374604+00:00","updated_at":"2026-04-17T01:22:03.374604+00:00","problems":[{"fix":"Add the necessary import statement: `from pipe import select` (or the specific function you are using).","cause":"Attempting to use a `pipe` function (like `select`, `where`, `take`) without explicitly importing it from the `pipe` module.","error":"NameError: name 'select' is not defined"},{"fix":"Ensure the initial object being piped is an iterable. If you have a single value, wrap it in a list: `[my_int] | select(...)`.","cause":"Trying to apply a pipe operation to a non-iterable object, such as an integer, instead of a list, tuple, or generator.","error":"TypeError: unsupported operand type(s) for |: 'int' and 'function'"},{"fix":"Call `list()`, `tuple()`, `set()`, `next()`, or iterate over the result to force evaluation: `final_data = list(initial_data | op1 | op2)`.","cause":"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.","error":"(No output/empty result when expected)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.2","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/JulienPalard/Pipe","docs":null,"changelog":null,"pypi":"https://pypi.org/project/pipe/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}