Skip to main content

LazySort

LazySort provides a wrapper around any sequence with random access. It computes and sorts only the necessary chunks of data on-demand when items or slices are accessed.

Installation

Using uv:

uv add lazysort

Or using pip:

pip install lazysort

Usage

from lazysort import LazySort

# An unsorted dataset.
data = [42, 15, 8, 23, 4, 16, 99, 51, 3]

# Wrap the dataset with LazySort.
# work_items_limit defines the maximum number of elements loaded into memory.
ls = LazySort(data, work_items_limit=4)

# Access elements as if the collection were sorted.
print(ls[0]) # Output: 3
print(ls[1]) # Output: 4
print(ls[-1]) # Output: 99

# Slicing is also fully supported.
print(tuple(ls[2:6]))

# Iteration yields elements in sorted order.
for item in ls: print(item)

# Using a custom key function and reverse sorting
complex_ls = LazySort(data, work_items_limit=4, key_fn=lambda x: x, reverse=True)

Changelog

v2

  • Stable production release with improved clustering algorithms and full test coverage.

v1

  • Initial release featuring core lazy sorting capabilities, indexing, and key function support. It has a bug in the processing of equal values.

License

This project is licensed under the MIT License.

Contact

LinkedIn

GitLab

Metadata

Release files for lazysort 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for lazysort 2.1.0
File Interpreter ABI Platform Actions
lazysort-2.1.0-py3-none-any.whl Python 3 none any Details for lazysort-2.1.0-py3-none-any.whl

Release files / lazysort-2.1.0-py3-none-any.whl

Download URL lazysort-2.1.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0061d4ee566f5fad516d38456faa96434c6cd10c2f43420f851be4c778b98b73
BLAKE2b-256 checksum
How to use checksums
e02566ce375b17c8fbc71760ade8c0ddafc5e33b5834cdb8365c25349e44c00e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for lazysort 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page