constantdict
An immutable dict class.
Decision gist · record as of 2026-08-14
Yes, if you need an immutable, hashable dict and want a lightweight, permissively licensed option. Install with caution given aging maintenance (last commit 2025-07-21, no recent releases), but the package is stable, has no known vulnerabilities, and low install friction. Best for projects where immutable dicts are a core requirement rather than an occasional convenience.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.7 or later.
- Low install friction with only two lightweight runtime dependencies (importlib-metadata and typing-extensions).
- Maintenance status is aging—last commit was 2025-07-21, with no releases in the past 389 days, though the repository remains active and unarchived.
License · maintenance · safety
permissive license (permissive) — MIT License permits unrestricted use, modification, and distribution with minimal restrictions, making it suitable for both open-source and proprietary projects.
last release 2025-07-21 (389 days) · last repo commit 2025-07-21 · 6 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 74,056 downloads/mo, #14,882 on PyPI
Alternatives
Verify before relying
pip install constantdict
from constantdict import constantdict
cd = constantdict({1: 2})
print(hash(cd)) # hashable and cached
cd_new = cd.setdefault(10, 5) # returns mutated copy- Performance comparison claims against other immutable dict implementations need independent verification.
- Actual use adoption and community feedback beyond download statistics are not evident from the fact sheet.
What it is and what it does
constantdict is a lightweight immutable dictionary implementation that sits on top of Python's built-in dict. It prevents accidental in-place modifications by raising AttributeError on attempts to mutate (like setting items, popping, or clearing), while remaining fully hashable with cached hashes and comparable to regular dicts. The class is designed to be faster than some alternative immutable dictionary libraries.
You use it when you need a dict-like object that can serve as a dictionary key, be safely shared across code without fear of mutation, or benefit from cached hashing. It supports both functional-style operations (returning new immutable copies via setdefault, update, delete) and bulk mutation via a mutate()/finish() pattern for performance when making multiple changes at once.
Use it for
- Use as dictionary keys in sets or as dict keys where regular dicts cannot be used due to mutability.
- Share configuration or lookup tables across functions without risk of accidental modification.
- Cache immutable snapshots of data where hash stability and equality checks matter.
- Bulk-update immutable structures efficiently via mutate()/finish() when creating many variants.
- Replace frozendict or other immutable dict implementations when performance is a concern.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need an immutable, hashable dict and want a lightweight, permissively licensed option.
Install with caution given aging maintenance (last commit 2025-07-21, no recent releases), but the package is stable, has no known vulnerabilities, and low install friction. Best for projects where immutable dicts are a core requirement rather than an occasional convenience.
Install
constantdict on PyPI
Before you install
Low install friction with only two lightweight runtime dependencies (importlib-metadata and typing-extensions). Maintenance status is aging—last commit was 2025-07-21, with no releases in the past 389 days, though the repository remains active and unarchived.
Requires Python 3.7 or later.
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal restrictions, making it suitable for both open-source and proprietary projects.
Quickstart
pip install constantdict
from constantdict import constantdict
cd = constantdict({1: 2})
print(hash(cd)) # hashable and cached
cd_new = cd.setdefault(10, 5) # returns mutated copy
Verify before relying
- Performance comparison claims against other immutable dict implementations need independent verification.
- Actual use adoption and community feedback beyond download statistics are not evident from the fact sheet.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesimportlib-metadatatyping-extensions |
| Maintenance | Aging 389 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 74,056 / month, #14,882 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Software Development :: Libraries |
Evidence: constantdict-2025.3-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 › “hashable dict”
- constantdictProvides an immutable dictionary class that wraps Python's built-in…
- frozendictProvides an immutable, hashable dictionary implementation with a…
- immutabledictProvides an immutable dictionary wrapper that implements the complete…
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 · itypes · zict · immutables · frozendict · pyrsistent · jaraco.collections · rpds-py · ml-collections · recordtype