sortedcontainers
Sorted Containers -- Sorted List, Sorted Dict, Sorted Set
Decision gist · record as of 2026-08-14
Yes, if you need sorted collections and are comfortable with an abandoned package. The code is mature and well-tested (100% coverage claimed), and the pure-Python implementation means no compilation hassles. However, do not adopt it for new projects expecting ongoing maintenance or compatibility updates—use it only when the specific API and behavior are a strong fit and you can maintain a fork if needed.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Installation is straightforward with no runtime dependencies and a pure-Python wheel.
- However, the package is abandoned—last release was 1916 days ago—so no maintenance or bug fixes should be expected.
License · maintenance · safety
Apache 2.0 (permissive) — Licensed under Apache 2.0 (permissive), allowing free use, modification, and distribution in both open-source and proprietary projects with minimal restrictions.
last release 2021-05-16 (1916 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 278,364,983 downloads/mo, #144 on PyPI
Alternatives
Verify before relying
pip install sortedcontainers
from sortedcontainers import SortedList, SortedDict, SortedSet
sl = SortedList([3, 1, 2])
sd = SortedDict({'b': 2, 'a': 1})
ss = SortedSet([3, 1, 2])- Whether the package remains compatible with Python versions released after the final 2021 release
- Real-world performance characteristics on modern Python implementations compared to contemporary alternatives
What it is and what it does
sortedcontainers provides three sorted collection types—SortedList, SortedDict, and SortedSet—written entirely in Python without C extensions. Each maintains sorted order automatically and supports efficient operations like bisect, range queries, and indexed access. The implementation uses a segmented approach to minimize insertion overhead while keeping memory usage low.
The package is designed as a drop-in replacement for use cases where Python's standard library lacks sorted collections. It has no runtime dependencies and installs as a pure-Python wheel, making deployment simple. However, the project is no longer maintained; the last release was in 2021, so users should be aware that no new features or bug fixes will be provided.
Use it for
- Maintain a sorted list of events or records where insertion order matters and efficient range queries are needed
- Build a sorted dictionary for leaderboards or rankings where you need to retrieve top-N items by index
- Implement a sorted set for deduplication while preserving order, such as in event processing pipelines
- Replace blist or bintrees when a pure-Python alternative without C compilation is preferred
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need sorted collections and are comfortable with an abandoned package.
The code is mature and well-tested (100% coverage claimed), and the pure-Python implementation means no compilation hassles. However, do not adopt it for new projects expecting ongoing maintenance or compatibility updates—use it only when the specific API and behavior are a strong fit and you can maintain a fork if needed.
Install
sortedcontainers on PyPI
Before you install
Installation is straightforward with no runtime dependencies and a pure-Python wheel. However, the package is abandoned—last release was 1916 days ago—so no maintenance or bug fixes should be expected.
License in practice
Licensed under Apache 2.0 (permissive), allowing free use, modification, and distribution in both open-source and proprietary projects with minimal restrictions.
Quickstart
pip install sortedcontainers
from sortedcontainers import SortedList, SortedDict, SortedSet
sl = SortedList([3, 1, 2])
sd = SortedDict({'b': 2, 'a': 1})
ss = SortedSet([3, 1, 2])
Verify before relying
- Whether the package remains compatible with Python versions released after the final 2021 release
- Real-world performance characteristics on modern Python implementations compared to contemporary alternatives
Package facts
| License | Apache 2.0 permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Abandoned 1,916 days since the last release |
| First released | |
| Downloads | 278,364,983 / month, #144 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy |
Evidence: sortedcontainers-2.4.0-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “sorted list python”
- sortedcontainersProvides sorted list, dict, and set data structures implemented in…
- sortedcollectionsProvides specialized sorted collection data structures (dictionaries,…
- streamlit-sortablesStreamlit Sortables adds drag-and-drop sortable list components to…
Give your agent the search over MCP, or paste the wish link into any chat.
Similar packages
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.
Provides type stubs for the sortedcontainers library, enabling type checkers like mypy to validate code using SortedDict, SortedSet, and SortedList with their specific API requirements.
Provides four specialized collection types—bag (multiset), setlist (ordered set), bijection (one-to-one mapping), and IndexedDict (ordered dict with index access)—as pure Python implementations with no external dependencies.
Provides an efficient, ordered set data structure for integers backed by the CRoaring C library, supporting both 32-bit and 64-bit values with fast set operations.
Provides multiple ordered set implementations (OrderedSet, StableSet, OrderlySet, SortedSet) that maintain insertion order while supporting set operations like union, intersection, and difference.
Queuelib provides in-memory and disk-persisted queue, stack, priority queue, and round-robin collection implementations with a simple API.
Install it if you need disk-backed queues or priority/round-robin scheduling; skip it if you require thread-safety or distributed queue semantics.
See also diskcache · diskcache-weave · pottery · pytest-unordered