{"id":18592892,"url":"https://github.com/litestar-org/fast-query-parsers","last_synced_at":"2026-03-06T21:08:19.378Z","repository":{"id":65109010,"uuid":"570996058","full_name":"litestar-org/fast-query-parsers","owner":"litestar-org","description":"Ultra-fast query string and url-encoded form-data parsers","archived":false,"fork":false,"pushed_at":"2026-02-15T16:27:21.000Z","size":215,"stargazers_count":43,"open_issues_count":6,"forks_count":8,"subscribers_count":7,"default_branch":"main","last_synced_at":"2026-02-15T23:28:01.053Z","etag":null,"topics":["form-data","hacktoberfest","json","json-parser","litestar","litestar-api","litestar-framework","litestar-meta","parser","python","querystring","rust","starlite","starlite-api"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/litestar-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","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},"funding":{"github":["litestar-org"],"open_collective":"litestar","polar":"litestar-org"}},"created_at":"2022-11-26T20:15:03.000Z","updated_at":"2026-02-15T16:24:39.000Z","dependencies_parsed_at":"2024-06-19T05:29:27.089Z","dependency_job_id":"05fb96e3-b78f-423c-9fe9-e1a7a49ab1bf","html_url":"https://github.com/litestar-org/fast-query-parsers","commit_stats":null,"previous_names":["starlite-api/fast-query-parsers"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/litestar-org/fast-query-parsers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litestar-org%2Ffast-query-parsers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litestar-org%2Ffast-query-parsers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litestar-org%2Ffast-query-parsers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litestar-org%2Ffast-query-parsers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/litestar-org","download_url":"https://codeload.github.com/litestar-org/fast-query-parsers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litestar-org%2Ffast-query-parsers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29609524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["form-data","hacktoberfest","json","json-parser","litestar","litestar-api","litestar-framework","litestar-meta","parser","python","querystring","rust","starlite","starlite-api"],"created_at":"2024-11-07T01:10:29.821Z","updated_at":"2026-02-19T09:37:51.143Z","avatar_url":"https://github.com/litestar-org.png","language":"Rust","funding_links":["https://github.com/sponsors/litestar-org","https://opencollective.com/litestar","https://polar.sh/litestar-org"],"categories":[],"sub_categories":[],"readme":"\u003c!-- markdownlint-disable --\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/litestar-org/branding/blob/473f54621e55cde9acbb6fcab7fc03036173eb3d/assets/Branding%20-%20SVG%20-%20Transparent/Logo%20-%20Banner%20-%20Inline%20-%20Light.svg#gh-light-mode-only\" alt=\"Litestar Logo - Light\" width=\"100%\" height=\"auto\" /\u003e\n  \u003cimg src=\"https://github.com/litestar-org/branding/blob/473f54621e55cde9acbb6fcab7fc03036173eb3d/assets/Branding%20-%20SVG%20-%20Transparent/Logo%20-%20Banner%20-%20Inline%20-%20Dark.svg#gh-dark-mode-only\" alt=\"Litestar Logo - Dark\" width=\"100%\" height=\"auto\" /\u003e\n\u003c/p\u003e\n\u003c!-- markdownlint-restore --\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n\u003c!-- prettier-ignore-start --\u003e\n\n| Project   |     | Status                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |\n|-----------|:----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| CI/CD     |     | [![Publish](https://github.com/litestar-org/fast-query-parsers/actions/workflows/publish.yaml/badge.svg)](https://github.com/litestar-org/fast-query-parsers/actions/workflows/publish.yaml) [![CI](https://github.com/litestar-org/fast-query-parsers/actions/workflows/ci.yaml/badge.svg)](https://github.com/litestar-org/fast-query-parsers/actions/workflows/ci.yaml)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |\n| Package   |     | [![PyPI - Version](https://img.shields.io/pypi/v/fast-query-parsers?labelColor=202235\u0026color=edb641\u0026logo=python\u0026logoColor=edb641)](https://badge.fury.io/py/litestar) ![PyPI - Support Python Versions](https://img.shields.io/pypi/pyversions/fast-query-parsers?labelColor=202235\u0026color=edb641\u0026logo=python\u0026logoColor=edb641) ![PyPI - Downloads](https://img.shields.io/pypi/dm/fast-query-parsers?logo=python\u0026label=fast-query-parsers%20downloads\u0026labelColor=202235\u0026color=edb641\u0026logoColor=edb641)                                                                                                                                                                                                                                                                                                                                                                                                                   |\n| Community |     | [![Reddit](https://img.shields.io/reddit/subreddit-subscribers/litestarapi?label=r%2FLitestar\u0026logo=reddit\u0026labelColor=202235\u0026color=edb641\u0026logoColor=edb641)](https://reddit.com/r/litestarapi) [![Discord](https://img.shields.io/discord/919193495116337154?labelColor=202235\u0026color=edb641\u0026label=chat%20on%20discord\u0026logo=discord\u0026logoColor=edb641)](https://discord.gg/X3FJqy8d2j) [![Matrix](https://img.shields.io/badge/chat%20on%20Matrix-bridged-202235?labelColor=202235\u0026color=edb641\u0026logo=matrix\u0026logoColor=edb641)](https://matrix.to/#/#litestar:matrix.org) [![Medium](https://img.shields.io/badge/Medium-202235?labelColor=202235\u0026color=edb641\u0026logo=medium\u0026logoColor=edb641)](https://blog.litestar.dev) [![Twitter](https://img.shields.io/twitter/follow/LitestarAPI?labelColor=202235\u0026color=edb641\u0026logo=twitter\u0026logoColor=edb641\u0026style=flat)](https://twitter.com/LitestarAPI) [![Blog](https://img.shields.io/badge/Blog-litestar.dev-202235?logo=blogger\u0026labelColor=202235\u0026color=edb641\u0026logoColor=edb641)](https://blog.litestar.dev) |\n| Meta      |     | [![Litestar Project](https://img.shields.io/badge/Litestar%20Org-%E2%AD%90%20Fast%20Query%20Parsers-202235.svg?logo=python\u0026labelColor=202235\u0026color=edb641\u0026logoColor=edb641)](https://github.com/litestar-org/fast-query-parsers) [![License - MIT](https://img.shields.io/badge/license-MIT-202235.svg?logo=python\u0026labelColor=202235\u0026color=edb641\u0026logoColor=edb641)](https://spdx.org/licenses/) [![Litestar Sponsors](https://img.shields.io/badge/Sponsor-%E2%9D%A4-%23edb641.svg?\u0026logo=github\u0026logoColor=edb641\u0026labelColor=202235)](https://github.com/sponsors/litestar-org) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json\u0026labelColor=202235)](https://github.com/astral-sh/ruff)|\n\n\u003c!-- prettier-ignore-end --\u003e\n\u003c/div\u003e\n\n# Fast Query Parsers\n\nThis library includes ultra-fast Rust based query string and urlencoded parsers. These parsers are used\nby [`Litestar`](https://github.com/litestar-org/litestar), but are developed separately - and can of course be used separately.\n\n\u003c/div\u003e\n\n## Installation\n\n```shell\npip install fast-query-parsers\n```\n\n## Usage\n\nThe library exposes two function `parse_query_string` and `parse_url_encoded_dict`.\n\n### `parse_query_string`\n\nThis function is used to parse a query string into a list of key/value tuples.\n\n```python\nfrom fast_query_parsers import parse_query_string\n\nresult = parse_query_string(b\"value=1\u0026value=2\u0026type=dollar\u0026country=US\", \"\u0026\")\n# [(\"value\", \"1\"), (\"value\", \"2\"), (\"type\", \"dollar\"), (\"country\", \"US\")]\n```\n\nThe first argument to this function is a byte string that includes the query string to be parsed, the second argument is\nthe separator used.\n\n#### Benchmarks\n\nQuery string parsing is more than x5 times faster than the standard library:\n\n```text\nstdlib parse_qsl parsing query string: Mean +- std dev: 2.86 us +- 0.03 us\n.....................\nparse_query_string parsing query string: Mean +- std dev: 916 ns +- 13 ns\n.....................\nstdlib parse_qsl parsing urlencoded query string: Mean +- std dev: 8.30 us +- 0.10 us\n.....................\nparse_query_string urlencoded query string: Mean +- std dev: 1.50 us +- 0.03 us\n```\n\n### `parse_url_encoded_dict`\n\nThis function is used to parse a url-encoded form data dictionary and parse it into the python equivalent of JSON types.\n\n```python\nfrom urllib.parse import urlencode\n\nfrom fast_query_parsers import parse_url_encoded_dict\n\nencoded = urlencode(\n    [\n        (\"value\", \"10\"),\n        (\"value\", \"12\"),\n        (\"veggies\", '[\"tomato\", \"potato\", \"aubergine\"]'),\n        (\"nested\", '{\"some_key\": \"some_value\"}'),\n        (\"calories\", \"122.53\"),\n        (\"healthy\", \"true\"),\n        (\"polluting\", \"false\"),\n        (\"json\", \"null\"),\n    ]\n).encode()\n\nresult = parse_url_encoded_dict(encoded, parse_numbers=True)\n\n# result == {\n#     \"value\": [10, 12],\n#     \"veggies\": [\"tomato\", \"potato\", \"aubergine\"],\n#     \"nested\": {\"some_key\": \"some_value\"},\n#     \"calories\": 122.53,\n#     \"healthy\": True,\n#     \"polluting\": False,\n#     \"json\": None,\n# }\n```\n\nThis function handles type conversions correctly - unlike the standard library function `parse_qs`. Additionally, it\ndoes not nest all values inside lists.\n\nNote: the second argument passed to `parse_url_encoded_dict` dictates whether numbers should be parsed. If `True`,\nthe value will be parsed into an int or float as appropriate, otherwise it will be kept as a string.\nBy default the value of this arg is `True`.\n\n#### Benchmarks\n\nUrl Encoded parsing is more than x2 times faster than the standard library, without accounting for parsing of values:\n\n```text\nstdlib parse_qs parsing url-encoded values into dict: Mean +- std dev: 8.99 us +- 0.09 us\n.....................\nparse_url_encoded_dict parse url-encoded values into dict: Mean +- std dev: 3.77 us +- 0.08 us\n```\n\nTo actually mimic the parsing done by `parse_url_encoded_dict` we will need a utility along these lines:\n\n```python\nfrom collections import defaultdict\nfrom contextlib import suppress\nfrom json import loads, JSONDecodeError\nfrom typing import Any\nfrom urllib.parse import parse_qsl\n\n\ndef parse_url_encoded_form_data(encoded_data: bytes) -\u003e dict[str, Any]:\n    \"\"\"Parse a url encoded form data into dict of parsed values\"\"\"\n    decoded_dict: defaultdict[str, list[Any]] = defaultdict(list)\n    for k, v in parse_qsl(encoded_data.decode(), keep_blank_values=True):\n        with suppress(JSONDecodeError):\n            v = loads(v) if isinstance(v, str) else v\n        decoded_dict[k].append(v)\n    return {k: v if len(v) \u003e 1 else v[0] for k, v in decoded_dict.items()}\n```\n\nWith the above, the benchmarks looks like so:\n\n```text\npython parse_url_encoded_form_data parsing url-encoded values into dict: Mean +- std dev: 19.7 us +- 0.1 us\n.....................\nparse_url_encoded_dict parsing url-encoded values into dict: Mean +- std dev: 3.69 us +- 0.03 us\n```\n\n## Contributing\n\nAll contributions are of course welcome!\n\n### Repository Setup\n\n1. Run `cargo install` to setup the rust dependencies and `uv sync` to setup the python dependencies.\n2. Install the pre-commit hooks with `pre-commit install` (requires [pre-commit](https://pre-commit.com/)).\n\n### Building\n\nRun `uv run maturin develop --release`. This wheel can be\nused in tests and benchmarks.\n\n### Benchmarking\n\nThere are basic benchmarks using pyperf in place. To run these execute `uv run benchmarks.py`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitestar-org%2Ffast-query-parsers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flitestar-org%2Ffast-query-parsers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitestar-org%2Ffast-query-parsers/lists"}