immutables
Immutable Collections
Decision gist · record as of 2026-08-14
Yes, if you need immutable mappings for functional patterns, concurrent code, or as hashable dictionary keys. The HAMT implementation offers solid performance and is battle-tested in CPython itself. Install friction is moderate due to compiled extensions, but wheels cover all major platforms. Maintenance is aging (no release in 9+ months), so not suitable for projects requiring active upstream support, but stable for established use.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Medium install friction due to compiled C extensions across multiple platforms (macOS x86/arm, Linux x86/aarch64, Windows).
- No runtime dependencies.
- Last commit May 2025 but no release since October 2024; maintenance status is aging.
License · maintenance · safety
Apache License, Version 2.0 (permissive) — Apache 2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
last release 2024-10-10 (673 days) · last repo commit 2025-05-20 · 1,204 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,948,816 downloads/mo, #2,811 on PyPI
Alternatives
Verify before relying
pip install immutables
import immutables
map1 = immutables.Map(a=1, b=2)
map2 = map1.set('a', 10)
print(map1['a'], map2['a']) # 1 10- Whether the HAMT implementation matches CPython 3.7+ contextvars performance characteristics in practice
- Specific use-case performance gains over dict copy-on-write approaches beyond the referenced benchmark
What it is and what it does
immutables provides a Hash Array Mapped Trie–based immutable mapping for Python, implementing the collections.abc.Mapping interface. It's the same data structure used in CPython's contextvars module (PEP 567). The Map type is hashable and pickleable, making it suitable for use as dictionary keys or in concurrent contexts where mutability is a liability.
Since Maps are immutable, mutations return new derived Maps rather than modifying in place. The package offers both single-operation methods (set, delete) and a MapMutation context manager for batching changes efficiently before finalizing a new Map. It has no runtime dependencies and supports Python 3.8 and later across CPython implementations on macOS, Linux, and Windows.
Use it for
- Use it for context variables and thread-local state where immutability prevents accidental mutations across async tasks
- Use it as keys in dictionaries or set members where hashability and immutability are required
- Use it in functional programming patterns where data transformations produce new collections without side effects
- Use it in concurrent or multi-threaded code to avoid synchronization overhead on shared data structures
- Use it for configuration objects that must remain unchanged after creation
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need immutable mappings for functional patterns, concurrent code, or as hashable dictionary keys.
The HAMT implementation offers solid performance and is battle-tested in CPython itself. Install friction is moderate due to compiled extensions, but wheels cover all major platforms. Maintenance is aging (no release in 9+ months), so not suitable for projects requiring active upstream support, but stable for established use.
Install
immutables on PyPI
Before you install
Medium install friction due to compiled C extensions across multiple platforms (macOS x86/arm, Linux x86/aarch64, Windows). No runtime dependencies. Last commit May 2025 but no release since October 2024; maintenance status is aging.
License in practice
Apache 2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install immutables
import immutables
map1 = immutables.Map(a=1, b=2)
map2 = map1.set('a', 10)
print(map1['a'], map2['a']) # 1 10
Verify before relying
- Whether the HAMT implementation matches CPython 3.7+ contextvars performance characteristics in practice
- Specific use-case performance gains over dict copy-on-write approaches beyond the referenced benchmark
Package facts
| License | Apache License, Version 2.0 permissive |
| Python support | Supports the current Python release >=3.8.0 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Aging 673 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,948,816 / month, #2,811 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Libraries |
Evidence: immutables-0.21-cp310-cp310-macosx_10_9_x86_64.whl; immutables-0.21-cp310-cp310-macosx_11_0_arm64.whl; immutables-0.21-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; immutables-0.21-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl; immutables-0.21-cp310-cp310-musllinux_1_2_aarch64.whl; immutables-0.21-cp310-cp310-musllinux_1_2_x86_64.whl; immutables-0.21-cp310-cp310-win32.whl; immutables-0.21-cp310-cp310-win_amd64.whl; immutables-0.21-cp311-cp311-macosx_10_9_x86_64.whl; immutables-0.21-cp311-cp311-macosx_11_0_arm64.whl; immutables-0.21-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; immutables-0.21-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl; immutables-0.21-cp311-cp311-musllinux_1_2_aarch64.whl; immutables-0.21-cp311-cp311-musllinux_1_2_x86_64.whl; immutables-0.21-cp311-cp311-win32.whl; immutables-0.21-cp311-cp311-win_amd64.whl; immutables-0.21-cp312-cp312-macosx_10_13_x86_64.whl; immutables-0.21-cp312-cp312-macosx_11_0_arm64.whl; immutables-0.21-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; immutables-0.21-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.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 › “hamt hash array mapped trie”
- immutablesProvides an immutable mapping type backed by a Hash Array Mapped Trie…
- trieImplements the Ethereum Merkle Trie data structure for efficient…
- dict-hashGenerates consistent hashes for Python dictionaries and supports…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also frozendict · frozenlist · lenses · constantdict · pyrsistent · multiset · immutabledict · rpds-py · jaraco.collections · marisa-trie