{"id":51029295,"url":"https://github.com/jiang-zhexin/temparse","last_synced_at":"2026-06-21T22:31:02.699Z","repository":{"id":361159802,"uuid":"1253077761","full_name":"jiang-zhexin/temparse","owner":"jiang-zhexin","description":"temparse is template + parse","archived":false,"fork":false,"pushed_at":"2026-06-08T08:23:36.000Z","size":34,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-08T10:15:33.378Z","etag":null,"topics":["parser","parser-library","python-3-14","t-string"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/temparse/","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/jiang-zhexin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2026-05-29T06:14:51.000Z","updated_at":"2026-06-08T08:22:39.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jiang-zhexin/temparse","commit_stats":null,"previous_names":["jiang-zhexin/temparse"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jiang-zhexin/temparse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiang-zhexin%2Ftemparse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiang-zhexin%2Ftemparse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiang-zhexin%2Ftemparse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiang-zhexin%2Ftemparse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jiang-zhexin","download_url":"https://codeload.github.com/jiang-zhexin/temparse/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiang-zhexin%2Ftemparse/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34628453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-21T02:00:05.568Z","response_time":54,"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":["parser","parser-library","python-3-14","t-string"],"created_at":"2026-06-21T22:31:02.059Z","updated_at":"2026-06-21T22:31:02.694Z","avatar_url":"https://github.com/jiang-zhexin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# temparse\n\n**temparse = template + parse**, parse strings using t-string templates.\n\nInspired by [parse](https://github.com/r1chardj0n3s/parse), but built on Python\n3.14's [t-strings](https://peps.python.org/pep-0750/), with better type hints.\n\n## Installation\n\n### uv\n\n```bash\nuv add temparse\n```\n\n### pip\n\n```bash\n# Requires Python \u003e= 3.14.\npip install temparse\n```\n\n## Quick Start\n\n```python\nfrom temparse import parse\n\ncity, year = parse[str, int](\n    t\"I live in {str}, since {int}\", \"I live in Tokyo, since 2010\"\n)\nassert city == \"Tokyo\"\nassert year == 2010\n```\n\nThe return type is `tuple[str, int]`.\n\n## Supported Types\n\n| Interpolation                           | Example               | Output       |\n| --------------------------------------- | --------------------- | ------------ |\n| `{str}`                                 | `\"hello\"`             | `\"hello\"`    |\n| `{int}`                                 | `\"42\"`                | `42`         |\n| `{int}`                                 | `\"0xff\"`              | `255`        |\n| `{int:16}`                              | `\"ff\"`                | `255`        |\n| `{float}`                               | `\"3.14\"`              | `3.14`       |\n| `{complex}`                             | `\"-1.23+4.5j\"`        | `-1.23+4.5j` |\n| `{list}`                                | `'[1,2,3]'`           | `[1, 2, 3]`  |\n| `{dict}`                                | `'{\"a\":1}'`           | `{\"a\": 1}`   |\n| `{json}`                                | `'{\"a\":1}'`           | `{\"a\": 1}`   |\n| `{datetime.datetime:%d/%m/%y %H:%M:%S}` | `\"31/01/22 23:59:59\"` | `datetime`   |\n| `{datetime.date:%Y-%m-%d}`              | `\"2024-03-15\"`        | `date`       |\n| `{datetime.time:%H:%M:%S}`              | `\"13:23:27\"`          | `time`       |\n\n\u003e [!IMPORTANT]\n\u003e list and dict are just aliases for json.\n\n## Custom Conversions\n\nDecorate a function with `@Conversion` to use it directly in a template:\n\n```python\nfrom temparse import Conversion, parse\n\n\n@Conversion\ndef percent(s: str) -\u003e float:\n    return float(s.rstrip(\"%\")) / 100\n\n\n(result,) = parse[float](t\"x = {percent}\", \"x = 30%\")\nassert result == 0.3\n```\n\nWhen your converter needs the format spec as well, use `FormatConversion`:\n\n```python\nfrom temparse import FormatConversion, parse\n\n\n@FormatConversion\ndef between(s: str, spec: str) -\u003e str:\n    lo, hi = spec.split(\",\")\n    return s[int(lo) : int(hi)]\n\n\n(result,) = parse[str](t\"{between:2,5}\", \"abcdefg\")\nassert result == \"cde\"\n```\n\n## `Parser` (Compiled Templates)\n\nBuild a parser once and reuse it:\n\n```python\nfrom temparse import Parser\n\nparser = Parser[str, int, float](t\"{str} + {int} = {float}\")\n\nassert parser.parse(\"foo + 3 = 3.14\") == (\"foo\", 3, 3.14)\nassert parser.parse(\"bar + 7 = 2.72\") == (\"bar\", 7, 2.72)\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiang-zhexin%2Ftemparse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjiang-zhexin%2Ftemparse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiang-zhexin%2Ftemparse/lists"}