{"id":31645852,"url":"https://github.com/phantie/pipe-forward","last_synced_at":"2025-10-07T05:17:16.111Z","repository":{"id":314948907,"uuid":"1057441814","full_name":"phantie/pipe-forward","owner":"phantie","description":"A tiny functional composition utility for Python.  It allows you to create pipelines of functions using the | operator.  Similar to |\u003e (pipe forward) operator in F#.","archived":false,"fork":false,"pushed_at":"2025-09-15T19:19:33.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-15T21:16:59.564Z","etag":null,"topics":["fsh","functional-programming","pipe-forward","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phantie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-15T18:21:08.000Z","updated_at":"2025-09-15T19:21:22.000Z","dependencies_parsed_at":"2025-09-15T21:18:25.742Z","dependency_job_id":"370f24fe-f364-4496-86f5-12207b144107","html_url":"https://github.com/phantie/pipe-forward","commit_stats":null,"previous_names":["phantie/pipe-forward"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/phantie/pipe-forward","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantie%2Fpipe-forward","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantie%2Fpipe-forward/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantie%2Fpipe-forward/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantie%2Fpipe-forward/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phantie","download_url":"https://codeload.github.com/phantie/pipe-forward/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantie%2Fpipe-forward/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278722757,"owners_count":26034463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fsh","functional-programming","pipe-forward","python"],"created_at":"2025-10-07T05:16:52.289Z","updated_at":"2025-10-07T05:17:16.105Z","avatar_url":"https://github.com/phantie.png","language":"Python","readme":"# pipe-forward\n\nA tiny functional composition utility for Python.\n\nIt allows you to create pipelines of functions using the `|` operator.\n\nSimilar to `|\u003e` (pipe forward) operator in F#.\n\n---\n\n## Usage\n\n### Basic example\n\n```python\nfrom pipe_forward import P  # alias for StackPipe\n\n\nassert \"123\" @ (P(int) | float) == 123.0 # transform \"123\" to int, then to float\n                                         # quickly interpreted as written - direct flow\n\n# inverted flow (thumbs down)\nassert float(int(\"123\"))\n```\n\n### Call with standard semantics\n\n```python\nfrom pipe_forward import P\nfn = P(int) | float\nassert (P(int) | float)(\"123\") == fn(\"123\") == 123.0\n```\n\n### Call with @\n\n```python\nfrom pipe_forward import P\nfn = P(int) | float\nassert \"123\" @ fn == fn @ \"123\" == 123.0 # use prefix or suffix notation\n```\n\n### Composability\n\n```python\nfrom pipe_forward import P\n\n# linter correctly recognizes it as P[object, int]\nto_int = P(int) # convert to int\n\n# linter correctly recognizes it as P[object, str]\nto_str = to_int | str # convert to int, and then to str\n\nassert to_int(42.0) == 42\nassert to_str(42.0) == \"42\"\n```\n\n### StackPipe vs LoopPipe behavior\n\n`StackPipe` and `LoopPipe` are provided, with `P` as a short alias for `StackPipe`. They inhibit equal behavior, but implemented differently.\n\n```python\nfrom pipe_forward import StackPipe\nfrom pipe_forward import LoopPipe\n\nstack = StackPipe(float) | str\nloop = LoopPipe(float) | str\n\nassert stack(10) == loop(10) == \"10.0\"\n```\n\n## Why use this?\n\n- Succinct function composition with `|` operator\n- Type hint support\n- Immutable\n- Readable one-liners\n- Explicit\n\n---\n\n## Installation\n\n```bash\npip install git+https://github.com/phantie/pipe-forward.git -U\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphantie%2Fpipe-forward","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphantie%2Fpipe-forward","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphantie%2Fpipe-forward/lists"}