{"id":23977963,"url":"https://github.com/ertgl/natch","last_synced_at":"2025-04-14T02:01:43.633Z","repository":{"id":57444964,"uuid":"266529190","full_name":"ertgl/natch","owner":"ertgl","description":"Pattern matching library.","archived":false,"fork":false,"pushed_at":"2020-07-04T02:24:11.000Z","size":33,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T09:29:57.472Z","etag":null,"topics":["functional","matching","paradigm","pattern","python"],"latest_commit_sha":null,"homepage":"https://natch.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ertgl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-24T11:44:18.000Z","updated_at":"2022-10-09T12:17:52.000Z","dependencies_parsed_at":"2022-09-26T17:30:42.053Z","dependency_job_id":null,"html_url":"https://github.com/ertgl/natch","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ertgl%2Fnatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ertgl%2Fnatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ertgl%2Fnatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ertgl%2Fnatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ertgl","download_url":"https://codeload.github.com/ertgl/natch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248809032,"owners_count":21164895,"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","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":["functional","matching","paradigm","pattern","python"],"created_at":"2025-01-07T08:15:47.070Z","updated_at":"2025-04-14T02:01:43.594Z","avatar_url":"https://github.com/ertgl.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### [Natch](#)\n\nPattern matching library.\n\n[![PyPI Version](https://img.shields.io/pypi/v/natch?style=flat-square)](https://pypi.org/project/natch/)\n[![Docs](https://img.shields.io/badge/API-docs-blue.svg?style=flat-square)](https://natch.readthedocs.io)\n[![Status](https://img.shields.io/circleci/build/github/ertgl/natch?style=flat-square\u0026logo=circleci)](https://circleci.com/gh/ertgl/natch)\n[![GitHub](https://img.shields.io/badge/vcs-GitHub-blue.svg?style=flat-square\u0026logo=github)](https://github.com/ertgl/natch)\n[![MIT License](https://img.shields.io/pypi/l/natch?style=flat-square\u0026color=blue)](LICENSE.txt)\n\n---\n\n\n### [Overview](#overview)\n\u003ca name=\"overview\"\u003e\u003c/a\u003e\n\nNatch enables, but is not limited to, pattern matching in function headers with single or multi arities, by supporting linear or nested lookups including logical expressions; can be expanded by writing custom rule classes.\n\n\n**Conditional function headers:**\n\n````python\n@natch.lt(0)\ndef f(x):\n  return f(x * -1)\n\n\n@natch.gte(0)\ndef f(x):\n  return x + 1\n\n\n\u003e\u003e\u003e f(-1)\n\u003e\u003e\u003e 2\n\n````\n\n\nSee more [examples](https://natch.readthedocs.io/en/latest/guide/examples.html).\n\n\n### [Installing](#installing)\n\u003ca name=\"installing\"\u003e\u003c/a\u003e\n\nNatch can be installed and updated using [pip](https://pip.pypa.io/en/stable/quickstart/).\n\n```bash\n$ pip install -U natch\n```\n\n\n### [Troubleshooting](#troubleshooting)\n\u003ca name=\"troubleshooting\"\u003e\u003c/a\u003e\n\n\n- #### [RecursionError](#troubleshooting--recursion-error)\n\u003ca name=\"troubleshooting--recursion-error\"\u003e\u003c/a\u003e\n\n\u003e Python has a platform-dependent recursion limit. If your software requires too many nested function calls, it is recommended to avoid using recursive functions.\n\u003e \n\u003e If you still need to follow recursive approach, you may need to [set recursion limit](https://docs.python.org/3/library/sys.html#sys.setrecursionlimit) as necessary.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fertgl%2Fnatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fertgl%2Fnatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fertgl%2Fnatch/lists"}