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.

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.7-cp311-none-win_amd64.whl (123.0 kB view details)

Uploaded CPython 3.11 Windows x86-64

natsort_rs-0.1.7-cp311-cp311-manylinux_2_34_x86_64.whl (223.0 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.34+ x86-64

natsort_rs-0.1.7-cp311-cp311-macosx_11_0_arm64.whl (192.0 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

natsort_rs-0.1.7-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.7-cp310-none-win_amd64.whl (123.0 kB view details)

Uploaded CPython 3.10 Windows x86-64

natsort_rs-0.1.7-cp310-cp310-manylinux_2_34_x86_64.whl (223.0 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.34+ x86-64

natsort_rs-0.1.7-cp310-cp310-macosx_11_0_arm64.whl (192.0 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

natsort_rs-0.1.7-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.7-cp39-none-win_amd64.whl (123.0 kB view details)

Uploaded CPython 3.9 Windows x86-64

natsort_rs-0.1.7-cp39-cp39-manylinux_2_34_x86_64.whl (223.0 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.34+ x86-64

natsort_rs-0.1.7-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.7-cp38-none-win_amd64.whl (122.7 kB view details)

Uploaded CPython 3.8 Windows x86-64

natsort_rs-0.1.7-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.7-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.7-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for natsort_rs-0.1.7-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 b2b2022493e5c7ba32e5d21f4fed7076c3d1900b7e4b29e8f1795d82b4a8f1b0
MD5 acc9e44300559f96333e2c59542e9734
BLAKE2b-256 401bca9e4c66c6ce296e5f6e9357b151851a7a93867ca6d742b4d4e77463c2a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.7-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 021c6911c571a6b54e36faae3a31503dbb86c5897cb1b451fb2ce0f2194fb0f3
MD5 65a2cd04b627ec44b1927c9953720f50
BLAKE2b-256 4db74695376b87fe0c2312a0113415710f1ad2ab3612118410ce0b4ea949b366

See more details on using hashes here.

File details

Details for the file natsort_rs-0.1.7-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for natsort_rs-0.1.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7385e3ee137cbc0f03ff1f9df5c903bf38211270731ab9442f8e4d27b68766a2
MD5 e8b8001b273475955bb958a7c159898a
BLAKE2b-256 e7b5abbb760b999244e73092bb5ac005737f382976986cbf295dca6ba630ba6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.7-cp311-cp311-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 4592a2258e2b7c5b09aba049d6890fd5611348471bd2e7c33b6575a23980e250
MD5 cf5807937ebcd138f6aee1cc7446ecf3
BLAKE2b-256 155798ca515222e78ad6d97ea5c37397d313e185a03d3cc85614b9929da23489

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.7-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 58671d663128d4df4277035d9114198da54836c7281ec028b250e5eafa441aa0
MD5 fb72530d87c1ac7527bf20dbaa4f34aa
BLAKE2b-256 c860b2c863dc3113a27e457e5dfcebc1972caaf6d892337620cc98c1fcfbe5d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.7-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9cc099da36ef132cc9f9b8ec8ea72bd662de48ff5f3a3750f8c36754b689314f
MD5 aaeb3fe5978bc5fde2ff075b245db7f6
BLAKE2b-256 0cc6b140e88dcb06b51d6d86d7afb640ef84f11075ac21da0799cc708bde0eee

See more details on using hashes here.

File details

Details for the file natsort_rs-0.1.7-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for natsort_rs-0.1.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4acfbaa855d997a23a294aa56e62384cbb4520161f8a68378047cc7911cb6048
MD5 90671240cc3830bef1a1f680dcb9f2e9
BLAKE2b-256 5b27217009650e41302371c712b518ebfaa8dda191492e18e520c6b4e3db0428

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.7-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 9691a41c3eb60f322e72d16faa1013a8220dc52a4fdaf4ea29ec33dea6c97a71
MD5 fbd3ef4874e254adf83e9405c48931d8
BLAKE2b-256 d5957cfbc9a5552dbeaf9d8e079a24a89e3673eaf026f1c509686d73faaf6097

See more details on using hashes here.

File details

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

File metadata

  • Download URL: natsort_rs-0.1.7-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.7-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 c80664e9df86a72e5d72a81b814a84e72f0ad8bf6812d9d5eb362fea3bebf4ea
MD5 f40581eeef9452fd559fa20ad4d98b06
BLAKE2b-256 05bde97ecd6aab87d6d66787dd8739ae186b1534790b158e8e6d3f484b0edd22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.7-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4098bc942099d7c46cee3be3950ff7efafc60d15e7f58306e18c62a73e8d0c77
MD5 628baf028c7d8c9f9a44823c2a827698
BLAKE2b-256 6e22704b62b1b4cb1f55c998045151dbc480e20ac89aa7322f68accd10e843d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.7-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 7fec0509730c17c85063e6729be2442370c6a315224ba370392361141bd59444
MD5 94899378054d965c9d99ddeb2cdab7ae
BLAKE2b-256 a623bf420eda7ea1204fcb5517644844a4ce602ab98e6f06aa25059e5f65e0fa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: natsort_rs-0.1.7-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.7-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 2e5db418e20a19cb2c3319722dce960c2112dacbe6ff42853aa2018b11339acd
MD5 5693470d620076319f9a6b57ab7b5c35
BLAKE2b-256 94a97d9791891ca384848198837e6ecc8d329591721941520e6cf7ade439e725

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.7-cp38-cp38-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ab9a84ab7af4c96490e43f807b269f478363163706f2b5e69779d35acb935b41
MD5 43cfe4bd7af82d3a1b531a4dc8c94082
BLAKE2b-256 22cbeea8f5d433cd7e4e1930a61758ea5f6b72058542e7f5a3ed7fb949ab12d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.7-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 77a516278530ff4a81e4de8c573a3ac7281ead0ed5cd591ecbac3e8cf5686942
MD5 9955526c6f899baff6b4637e1e150afa
BLAKE2b-256 9a93faa58e52eb560ab45e5759834bdfb0e43f74221efca0dec0ffa52fbfd83b

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