frozendict
A simple immutable dictionary
Decision gist · record as of 2026-08-14
Yes. frozendict is actively maintained, has zero known vulnerabilities, imposes no runtime dependencies, and solves a genuine need for immutable, hashable dictionaries in Python. The LGPL v3 copyleft license is a consideration if you're building proprietary software, but poses no barrier to use in open-source or internal projects. Install it if you need immutable mappings for hashing, thread safety, or functional programming patterns.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- All values must be hashable if you intend to hash the frozendict itself; attempting to hash a frozendict with unhashable values raises TypeError.
- Low friction: pure Python wheel available, no runtime dependencies, and actively maintained with recent releases.
- Optional C extension available for performance but not required.
License · maintenance · safety
LGPL v3 (copyleft) — Licensed under LGPL v3 (copyleft): derivative works and modifications must be distributed under the same license, and source code must be made available to users who receive the software.
last release 2025-11-11 (276 days) · last repo commit 2026-05-08 · 181 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 17,608,249 downloads/mo, #1,108 on PyPI
Alternatives
Verify before relying
pip install frozendict
from frozendict import frozendict
fd = frozendict({'a': 1, 'b': 2})
print(hash(fd)) # hashable if all values are hashable
fd_new = fd.set('c', 3) # returns new frozendict- Performance comparison specifics: description mentions benchmarks but excerpt does not include actual numbers or scenarios.
- C extension performance impact: whether the optional C extension provides meaningful speedup for typical workloads is not quantified.
- deepfreeze recursion limits: maximum nesting depth or object graph size before hitting Python's recursion limit is not specified.
What it is and what it does
frozendict is an immutable dictionary that behaves like a standard Python dict but cannot be modified after creation. It supports hashing (when all values are hashable) and pickling, making it suitable for use as dictionary keys or in sets. The package provides both a frozendict class with a dict-compatible API minus mutation methods, plus a deepfreeze utility that recursively converts nested mutable structures into their immutable equivalents.
The implementation guarantees true immutability—internal variables cannot be changed and are themselves immutable objects. It supports standard dict operations like get(), keys(), values(), items(), and fromkeys(), plus immutable variants like set() and delete() that return new frozendict instances. The | operator merges a frozendict with a regular dict, producing a new frozendict. An optional C extension is available for performance, but a pure Python fallback ensures broad compatibility.
Use it for
- Use as dictionary keys or set members when you need hashable, immutable mappings for caching or memoization.
- Freeze nested data structures (lists, dicts, sets, custom objects) into immutable equivalents with deepfreeze().
- Define configuration or constant data that must not be accidentally modified during program execution.
- Serialize and deserialize immutable data structures via pickle while preserving hashability and immutability guarantees.
- Build functional-style code where data transformations return new frozendict instances rather than mutating state.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
frozendict is actively maintained, has zero known vulnerabilities, imposes no runtime dependencies, and solves a genuine need for immutable, hashable dictionaries in Python. The LGPL v3 copyleft license is a consideration if you're building proprietary software, but poses no barrier to use in open-source or internal projects. Install it if you need immutable mappings for hashing, thread safety, or functional programming patterns.
Install
frozendict on PyPI
Before you install
Low friction: pure Python wheel available, no runtime dependencies, and actively maintained with recent releases. Optional C extension available for performance but not required.
All values must be hashable if you intend to hash the frozendict itself; attempting to hash a frozendict with unhashable values raises TypeError.
License in practice
Licensed under LGPL v3 (copyleft): derivative works and modifications must be distributed under the same license, and source code must be made available to users who receive the software.
Quickstart
pip install frozendict
from frozendict import frozendict
fd = frozendict({'a': 1, 'b': 2})
print(hash(fd)) # hashable if all values are hashable
fd_new = fd.set('c', 3) # returns new frozendict
Verify before relying
- Performance comparison specifics: description mentions benchmarks but excerpt does not include actual numbers or scenarios.
- C extension performance impact: whether the optional C extension provides meaningful speedup for typical workloads is not quantified.
- deepfreeze recursion limits: maximum nesting depth or object graph size before hitting Python's recursion limit is not specified.
Package facts
| License | LGPL v3 copyleft |
| Python support | Supports the current Python release >=3.6 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 276 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 17,608,249 / month, #1,108 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 :: GNU Lesser General Public License v3 (LGPLv3)Natural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.6Topic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities |
Evidence: frozendict-2.4.7-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 › “immutable map”
- frozendictProvides an immutable, hashable dictionary implementation with a…
- immutablesProvides an immutable mapping type backed by a Hash Array Mapped Trie…
- rpds-pyProvides Python bindings to Rust's persistent data structures (rpds…
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 immutabledict · immutables · constantdict · zict · itypes · jaraco.collections · multiset · optionaldict · pyrsistent