{"library":"sortedcollections","title":"Python Sorted Collections","type":"library","description":"Sorted Collections provides CPython-optimized mutable sorted collections (SortedList, SortedDict, SortedSet) that maintain their order automatically. As of version 2.1.0, it targets Python 3.7+ and is actively maintained, with releases typically following bug fixes or minor enhancements to ensure stability and performance.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install sortedcollections"],"cli":null},"imports":["from sortedcollections import SortedList","from sortedcollections import SortedDict","from sortedcollections import SortedSet"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":"http://www.grantjenks.com/docs/sortedcollections/","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/sortedcollections/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"from sortedcollections import SortedDict\n\nsd = SortedDict()\nsd[5] = 'apple'\nsd[1] = 'banana'\nsd[3] = 'cherry'\n\nprint(f\"SortedDict items: {list(sd.items())}\")\n# Expected output: SortedDict items: [(1, 'banana'), (3, 'cherry'), (5, 'apple')]\n\n# Example with SortedList\nfrom sortedcollections import SortedList\n\nsl = SortedList([5, 1, 3, 2, 4])\nsl.add(0)\nprint(f\"SortedList: {list(sl)}\")\n# Expected output: SortedList: [0, 1, 2, 3, 4, 5]","lang":"python","description":"Demonstrates the creation and basic usage of SortedDict and SortedList, showing how elements are automatically kept in sorted order upon insertion.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"2.1.0","pypi_latest":"2.1.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.5,"avg_import_s":0.02,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"sortedcollections","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.01,"mem_mb":0.6,"disk_size":"18.1M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"sortedcollections","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.01,"mem_mb":0.6,"disk_size":"19M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"sortedcollections","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":1,"disk_size":"20.0M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"sortedcollections","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.02,"mem_mb":1,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"sortedcollections","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":0.8,"disk_size":"11.9M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"sortedcollections","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.4,"import_time_s":0.02,"mem_mb":0.8,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"sortedcollections","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":1.1,"disk_size":"11.6M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"sortedcollections","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.4,"import_time_s":0.02,"mem_mb":0.9,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"sortedcollections","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.01,"mem_mb":0.6,"disk_size":"17.6M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"sortedcollections","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0.01,"mem_mb":0.6,"disk_size":"18M"}]}}