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

Uploaded CPython 3.11 Windows x86-64

natsort_rs-0.1.6-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.6-cp311-cp311-macosx_11_0_arm64.whl (192.0 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 Windows x86-64

natsort_rs-0.1.6-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.6-cp310-cp310-macosx_11_0_arm64.whl (192.0 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

File metadata

File hashes

Hashes for natsort_rs-0.1.6-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 eb662b014c476a70bcf2629ce7a5a0766ed4c7e02199a469193ae9ef19c52080
MD5 7933bbc9cc99474a9f2195a01e3f73b7
BLAKE2b-256 decd859ac15ae5a5123ce71777f7e29c885797b5b29418c8a786c67be5e2ae88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.6-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7564f5add5c65bcd95038668da7492bc33566b76bbe577862515a988960ac948
MD5 a032fd6ad44ccc6e629b051d80a06b23
BLAKE2b-256 936f01e9dce9da91638ca6e3ad1e21ba725411a8cc579f90ef16ade01376cbd5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 516a18f7d8d85b3e32bf2c970b93c9a3817dcdeb06daf1db86c9c882482779d5
MD5 05d63ef69e366b3ef7943f99cd3f747e
BLAKE2b-256 2a8aae4bd80e095cd5cf0e8634e424cfafc7812d46aee2fe57450f3ef6bdba17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.6-cp311-cp311-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 5ebb22bdc99d0a023a9c5e08d2a4a99806da39c09b91ab76bfd2600c5c2e6d60
MD5 3b4d68d3e06aaadd1cca07474dc88bf7
BLAKE2b-256 37b7d54170bc99f6c7323ef36b6d8ede041213bcd0cfb5b1f4fec8e327c4adc8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.6-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 acfc385b34b8c9e58b6d13102071560ffea2c6989a1c3d81a912df82b9cf4804
MD5 ba0a43f52f2eb88c658081f5a608acdb
BLAKE2b-256 337f63c5fe5c3e120671186b03466a414dc5abbf542bf12cff41c6af1779d98a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.6-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4b29cb63525903a522e20961d7dd1705af41b77d6c9badf7344043af5313114b
MD5 eaf839c14a03a3073cd9f8f9d12b5250
BLAKE2b-256 6330decab36cc8cfd590de2f95f453ae8c42ff25b408324d79740f894b905d8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 df4da806f26615f28cbd3489ebb38b9e5255f7863503b7e0c488b17a56d70d60
MD5 4362b37c090969f6bcd1f6f006a8cdc0
BLAKE2b-256 442e85c2d5faf5b552ab5375cc1ea4f1696865512634a9946e0f7e081e52a082

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.6-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 bc9f36419f8bcff6d0d747a98ca0f25e625b5e16e1bc20a80215ed1bbb3fd7a7
MD5 ed783e8e2788d484ff77f7d9cae7be0b
BLAKE2b-256 c7b91201a28db8aca99395637c861acb1b4de891f3d9786778f88acb4cadcda1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: natsort_rs-0.1.6-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.6-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 e11aa1423daacbbc728f33029f82d7ef53f6cb2deaf39483b4c124016933b4e3
MD5 0edcf5ca80564559775a23afc23fa9a6
BLAKE2b-256 e379198a651da6eb0cdb87b10c820282ba444ceececf4d4c18f952a094b88c77

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.6-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 46ded0d40d2756228702de9dc1505bacbdabc5235573e6063297dda57970fa82
MD5 c371b914ecdbab0b92f9f7c97121d722
BLAKE2b-256 7c88a8150913b2f89de0e67d3512c3021b907735a843c0a45face75e46c6ce96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.6-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 ea97b38e2a3fe23d250787a1302f093c7f9c5c2208a379a446bdda6d50455b33
MD5 2f60a638772fa1dae584a8a28e08114a
BLAKE2b-256 7602977622db6becc4015c6b751167e140ed5e5cc8b3aa4708d7937c5215085c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: natsort_rs-0.1.6-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.6-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 457b8b2482271730a979caafb77633a65ae52115559cdf6be4f7e0687deace17
MD5 86f26e0c48084ee02b6d233b78be2009
BLAKE2b-256 c94050a5bc8cfa9f56e200595286f5ed7bbd70b77a691c188edc4ed5754b2502

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.6-cp38-cp38-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ab253bd6b7e6bea55e347af82ea97c81a7f1cb81845474ef97f72fed7ee966fc
MD5 66732a186b3134eaf9bc528e436381bf
BLAKE2b-256 7d29d5d66408ad04278af4d962ddcd8113481a14a0f4fa4c2de16d0d785640b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natsort_rs-0.1.6-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 647d59d828b2912b20960dab0beae25445aefc8b8d163c1f9fd11ae67978e092
MD5 0fb58127a9464c1769b390fbb8eecfb8
BLAKE2b-256 b1bc7210fa1960156ca85bed958d17764e1a91c1cfe96e7d2d45014f4443150b

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