Skip to main content

A blazing fast natural sorting library for Python

Project description

natsort-rs

A blazing fast natural sorting library for Python written in Rust 🚀

Warning: This is a pre-alpha library. It should not yet be used for production code.

Installation

Find package files on PyPI.

Note: Currently, there exist no builds for Apple Silicon chips.

Examples

from natsort_rs import natsort

Sort a list of strings

items = ['item 1', 'item 10', 'item 3']
print(natsort(items))  
# ['item 1', 'item 3', 'item 10']

Sort case insensitively

items = ['Item 1', 'Item 3', 'item 2']
print(natsort(items, ignore_case=True))
# ['Item 1', 'item 2', 'Item 3']

Sort complex objects based on property

items = [
    {'name': 'item 1', 'id': 1},
    {'name': 'item 3', 'id': 3},
    {'name': 'item 2', 'id': 2}
]
print(natsort(items, key=lambda d: d['name']))
# [{'name': 'item 1', 'id': 1}, {'name': 'item 2', 'id': 2}, {'name': 'item 3', 'id': 3}]

Benchmark

No. of items natsort [s] natsort-rs [s] speedup [-]
10 0.00006 0.00000 17.0
100 0.00071 0.00003 24.6
1000 0.00285 0.00036 7.9
10000 0.02892 0.00462 6.3
100000 0.29960 0.06098 4.9
1000000 3.33878 0.80086 4.2

Execute benchmark.py to reproduce the results.

Credits

This Python module is build on top of the human-sort crate and inspired by natsort.

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

natsort_rs-0.1.5-cp311-none-win_amd64.whl (123.0 kB view details)

Uploaded CPython 3.11 Windows x86-64

natsort_rs-0.1.5-cp311-cp311-manylinux_2_34_x86_64.whl (223.1 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.34+ x86-64

natsort_rs-0.1.5-cp311-cp311-macosx_10_7_x86_64.whl (200.7 kB view details)

Uploaded CPython 3.11 macOS 10.7+ x86-64

natsort_rs-0.1.5-cp310-none-win_amd64.whl (123.0 kB view details)

Uploaded CPython 3.10 Windows x86-64

natsort_rs-0.1.5-cp310-cp310-manylinux_2_34_x86_64.whl (223.1 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.34+ x86-64

natsort_rs-0.1.5-cp310-cp310-macosx_10_7_x86_64.whl (200.7 kB view details)

Uploaded CPython 3.10 macOS 10.7+ x86-64

natsort_rs-0.1.5-cp39-none-win_amd64.whl (123.0 kB view details)

Uploaded CPython 3.9 Windows x86-64

natsort_rs-0.1.5-cp39-cp39-manylinux_2_34_x86_64.whl (223.1 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.34+ x86-64

natsort_rs-0.1.5-cp39-cp39-macosx_10_7_x86_64.whl (200.5 kB view details)

Uploaded CPython 3.9 macOS 10.7+ x86-64

natsort_rs-0.1.5-cp38-none-win_amd64.whl (122.7 kB view details)

Uploaded CPython 3.8 Windows x86-64

natsort_rs-0.1.5-cp38-cp38-manylinux_2_34_x86_64.whl (223.1 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.34+ x86-64

natsort_rs-0.1.5-cp38-cp38-macosx_10_7_x86_64.whl (200.7 kB view details)

Uploaded CPython 3.8 macOS 10.7+ x86-64

File details

Details for the file natsort_rs-0.1.5-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for natsort_rs-0.1.5-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 94babd6b14a3d8bde910f06a084c7d38f1b9eefd66bd9880d4d014ab2173ba32
MD5 e54da0d7e6128a50433eb8cca4720120
BLAKE2b-256 b50738a3e438507961f64891e53729ff35fd96704dd1c94c1fa19f0559010541

See more details on using hashes here.

File details

Details for the file natsort_rs-0.1.5-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for natsort_rs-0.1.5-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e8d15a3f7013c190fd091e655c49c8905a30992d54540288d87c2de57ca43937
MD5 4753c1478be8571517519c549c822f61
BLAKE2b-256 9146097e5b43c5650225814f4d9c2d01e3fa5ec74b4d524609596dcd1580e0b5

See more details on using hashes here.

File details

Details for the file natsort_rs-0.1.5-cp311-cp311-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for natsort_rs-0.1.5-cp311-cp311-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 a529a8ff2ff2c410c81c0ee93a917537e6f2dd0f4820731961072ac5ec895023
MD5 0481d2143a0dea38b35c7915ee09a535
BLAKE2b-256 5ef514cfecab21ddeec9199bf4744280ca517e88ae935def8c84c5dcf35b936a

See more details on using hashes here.

File details

Details for the file natsort_rs-0.1.5-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for natsort_rs-0.1.5-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 09482fc3b1a0ee6a525533aa39d353e78653c35ace4c65a0295562e9aeff713e
MD5 99d80faf278cbd5a307b6dafe48494ad
BLAKE2b-256 98df14b7b3b28ca70cb17ded824cd2db41dc353a1091e0a6612a5a5be5b6b496

See more details on using hashes here.

File details

Details for the file natsort_rs-0.1.5-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for natsort_rs-0.1.5-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 fd007200c579e2fc97338daf47ea6cc857a19282f7e2d37d00fc53a56ae79440
MD5 6f6f151e6e2496db94d66213a764790d
BLAKE2b-256 338b041cb1cba7a029ff3212b200e490c13f09499ed33cbe4eba7942d98a7db3

See more details on using hashes here.

File details

Details for the file natsort_rs-0.1.5-cp310-cp310-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for natsort_rs-0.1.5-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 75113825a2aa1a150dd10e0a144f7e0f4e7fbe953bf044d5dec75ad030f5619c
MD5 23190b153188b06fe70453c03a67f290
BLAKE2b-256 c5055820fbcf1cf8404b7ca08284d24a8b855350cf2e2130e783f0503193cbd3

See more details on using hashes here.

File details

Details for the file natsort_rs-0.1.5-cp39-none-win_amd64.whl.

File metadata

  • Download URL: natsort_rs-0.1.5-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 123.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for natsort_rs-0.1.5-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 c38d3899aa7327f27ca8d2d06024c83c88ed9bb466f79fd4403e30b96f63f23d
MD5 f5f498e0032f73a159eadbf6600bdd90
BLAKE2b-256 0d4f474f67b50b64d8023bde0d3c125640bba98e7442fc2cbec62aabd39d8bbc

See more details on using hashes here.

File details

Details for the file natsort_rs-0.1.5-cp39-cp39-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for natsort_rs-0.1.5-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 78b1eff65bcce54d23e201593478bbbf7be434e45c74d00e9f81017850b2d513
MD5 048d71d788302b79bdec562efac59d43
BLAKE2b-256 d84ba9ca7551b86a4144b673cf2ab57d53cfce0f08866dcb047a6a3959b01787

See more details on using hashes here.

File details

Details for the file natsort_rs-0.1.5-cp39-cp39-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for natsort_rs-0.1.5-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 b9669a89855eb98770f051d8693a17d1950012e899a098d5e24408c1f03d61e9
MD5 d2bdf11f4f3daf016a5b0015f9ed41fc
BLAKE2b-256 16a763d803a7622e9db31a112deea7c8e08680b0b01f02999777afc90ae65f16

See more details on using hashes here.

File details

Details for the file natsort_rs-0.1.5-cp38-none-win_amd64.whl.

File metadata

  • Download URL: natsort_rs-0.1.5-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 122.7 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for natsort_rs-0.1.5-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 15c3e98ba6b405af9e2610c816ce429219f3e636234d5c9db64858c0b9d2b448
MD5 42c5ffa8c524ecd2aa8ab8f34d3d460b
BLAKE2b-256 91133e1bddda4b50bca8fb490e009398c8c876f4548058fba37a4ebe3ca8e0d9

See more details on using hashes here.

File details

Details for the file natsort_rs-0.1.5-cp38-cp38-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for natsort_rs-0.1.5-cp38-cp38-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 08c02725e7f4e0adf189bc2278acb18e08258b40ca52b574ec6f960826b1ebf5
MD5 8919b264c60657695420e4b3a864f18b
BLAKE2b-256 71716c481d461007af4cb8a9de8a2ffea6cde413722c064610e3fc5bd0d62081

See more details on using hashes here.

File details

Details for the file natsort_rs-0.1.5-cp38-cp38-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for natsort_rs-0.1.5-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 1a5a10ada67052dd75be393ed4452602b8a063e0a81d9a951a5f5aff92942011
MD5 594ddd5e9cc3461c0ef2190b57d98650
BLAKE2b-256 4c4a5e3c334a01a0b01ecc83ce87434c996527cbf4dd6341a41025669a9a07e4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page