{"id":50256637,"url":"https://github.com/valentinstn/natsort-rs","last_synced_at":"2026-06-12T22:00:52.054Z","repository":{"id":195317765,"uuid":"692378134","full_name":"valentinstn/natsort-rs","owner":"valentinstn","description":"A blazing fast natural sorting library for Python written in Rust","archived":false,"fork":false,"pushed_at":"2026-05-15T23:16:09.000Z","size":107,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-16T00:56:52.544Z","etag":null,"topics":["performance","python","rust","sorting"],"latest_commit_sha":null,"homepage":"","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/valentinstn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-09-16T09:51:23.000Z","updated_at":"2026-05-15T23:16:12.000Z","dependencies_parsed_at":"2023-09-17T13:21:34.784Z","dependency_job_id":"fae94f9c-3625-4a33-af56-3396e8234dd5","html_url":"https://github.com/valentinstn/natsort-rs","commit_stats":null,"previous_names":["valentinstn/natsort-rs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/valentinstn/natsort-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valentinstn%2Fnatsort-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valentinstn%2Fnatsort-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valentinstn%2Fnatsort-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valentinstn%2Fnatsort-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valentinstn","download_url":"https://codeload.github.com/valentinstn/natsort-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valentinstn%2Fnatsort-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34263874,"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-12T02:00:06.859Z","response_time":109,"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":["performance","python","rust","sorting"],"created_at":"2026-05-27T06:31:27.811Z","updated_at":"2026-06-12T22:00:52.047Z","avatar_url":"https://github.com/valentinstn.png","language":"Python","funding_links":[],"categories":["Sorting"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003enatsort-rs\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n    \u003cem\u003e🚀 A blazing fast natural sorting library for Python written in Rust 🦀\u003c/em\u003e\n\u003c/p\u003e\n\n## Installation\n\n```\npip install natsort-rs\n```\n\n## Usage\n\n```py\nfrom natsort_rs import natsort\n```\n\n### Sort a list of strings\n\n```py\nitems = ['item 1', 'item 10', 'item 3']\nprint(natsort(items))  \n# ['item 1', 'item 3', 'item 10']\n```\n\n### Sort case insensitively\n\n```py\nitems = ['Item 1', 'Item 3', 'item 2']\nprint(natsort(items, ignore_case=True))\n# ['Item 1', 'item 2', 'Item 3']\n```\n\n### Sort complex objects based on property\n\n```py\nitems = [\n    {'name': 'item 1', 'id': 1},\n    {'name': 'item 3', 'id': 3},\n    {'name': 'item 2', 'id': 2}\n]\nprint(natsort(items, key=lambda d: d['name']))\n# [{'name': 'item 1', 'id': 1}, {'name': 'item 2', 'id': 2}, {'name': 'item 3', 'id': 3}]\n```\n\n### Type-safe sorting\n\nThe return type is inferred based on the input list type, so no casting is needed:\n\n```py\nitems: list[str] = ['item 1', 'item 10', 'item 3']\nresult = natsort(items)\n# result is list[str]\n\nitems_int: list[int] = [10, 3, 1]\nresult_int = natsort(items_int)\n# result_int is list[int]\n```\n\n### Return the sorting indices\n\nThis can be helpful if you only want to get the sorted indices returned, that makes the performance-critical part\nuseful for custom sorting use cases:\n\n```py\nitems = ['item 1', 'item 10', 'item 3']\nprint(natsort(items, return_indices=True))  \n# [0, 2, 1]\n```\n\n## Benchmark\n\n| No. of items | Duration natsort [s] | Duration natsort-rs [s] | Relative speedup |\n|-----|-----|-----|-----|\n| 10 | 0.00006 | 0.00000 | 16.8 |\n| 100 | 0.00094 | 0.00002 | 44.3 |\n| 1000 | 0.00281 | 0.00022 | 12.7 |\n| 10000 | 0.02835 | 0.00262 | 10.8 |\n| 100000 | 0.29712 | 0.03334 | 8.9 |\n| 1000000 | 3.31207 | 0.45333 | 7.3 |\n\nExecute `benchmark.py` to reproduce the results.\n\n## Development\n\n### Local build\n\nTo build and test the package locally using `uv`:\n\n```bash\nuv run maturin develop --release\n```\n\n### Running benchmarks\n\nTo run benchmarks:\n\n```bash\nuv run benchmark.py\n```\n\nThis will compare the performance of `natsort-rs` against the pure Python `natsort` library and display results in a table format.\n\n### Run tests\n\n```bash\nuv run -m unittest discover tests\n```\n\n## Credits\n\nThis Python module is build on top of the [`natord`](https://docs.rs/natord/latest/natord/) crate and inspired by [`natsort`](https://pypi.org/project/natsort/).\n\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentinstn%2Fnatsort-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalentinstn%2Fnatsort-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentinstn%2Fnatsort-rs/lists"}