--- id: sortedcollections version: "2.1.0" license: Apache 2.0 license_treatment: permissive maintenance: abandoned --- # sortedcollections — Python Sorted Collections License: permissive · Maintenance: abandoned · Downloads: 343.5K/mo ## What it is and what it does Sorted Collections extends the sortedcontainers library with higher-level data structures that combine sorting with indexed access. It provides ValueSortedDict (dictionary sorted by values), ItemSortedDict (with key-function support), NearestDict (nearest-key lookup), OrderedDict and OrderedSet (with numeric indexing), IndexableDict and IndexableSet (numeric indexing on standard types), and SegmentList (fast random-access insertion/deletion). All implementations are pure Python and built on sortedcontainers. The package is designed for developers who need sorted collections with efficient indexed access rather than the linear cost of standard Python sorted() calls. It was actively maintained through early 2021 but has since been abandoned, meaning no updates for newer Python versions or bug fixes will be released. Use it for: - Build a leaderboard or ranking system where you need to access top entries by score efficiently - Implement a cache or priority queue where items must be sorted by value and accessed by position - Create a time-series data structure where you need both chronological order and fast nearest-key lookup - Store configuration or metadata where insertion order and numeric indexing matter more than hash-based access - Develop an interval tree or segment-based data structure for range queries with fast insertion/deletion ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides specialized sorted collection data structures (dictionaries, sets, lists) that maintain order and support efficient indexed access and value-based sorting, built on top of sortedcontainers. Yes, if you need the specific sorted collection types it provides and your codebase targets Python 3.6 through 3.9. No, if you require ongoing maintenance, support for newer Python versions, or active bug fixes—the package is abandoned and has not been updated since 2021-01-18. Consider it stable for legacy codebases but risky for new projects. ## Install pip install sortedcollections uv add sortedcollections poetry add sortedcollections ## Installing sortedcollections Before you install: Low friction installation with a single pure-Python dependency. However, the package is abandoned—last released in January 2021 and has not been updated since—so expect no maintenance, bug fixes, or compatibility updates. License in practice: Apache 2.0 permissive license allows free use, modification, and distribution in both open-source and commercial projects with minimal restrictions. Quickstart: pip install sortedcollections from sortedcollections import ValueSortedDict vsd = ValueSortedDict({1: 'a', 2: 'b', 3: 'c'}) print(vsd[0]) # Access by index Verify before relying: - Whether the package remains compatible with Python versions beyond 3.9 given the January 2021 release cutoff - Real-world performance characteristics compared to standard dict/set for typical workloads - Whether sortedcontainers dependency has received updates that might affect behavior or compatibility ## Package facts - License: Apache 2.0 (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 343.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sorted dictionary with indexing, ordered set with numeric access, value-sorted collections, indexed sorted data structures, nearest-key lookup dictionary, segment list fast insertion, ordered collections python, data-structures, sorted-collections [View on SkillFed](https://skillfed.io/packages/sortedcollections) · [View on PyPI](https://pypi.org/project/sortedcollections/)