types-frozendict
raw JSON → 2.0.9 verified Fri May 01 auth: no python
Typing stubs for the frozendict library, providing type hints for frozen dictionaries. Currently version 2.0.9, maintained as part of the typeshed project with updates aligned to Python and frozendict releases.
pip install types-frozendict Common errors
error ImportError: cannot import name 'frozendict' from 'frozendict' (unknown location) ↓
cause The frozendict package is not installed; types-frozendict only provides type stubs.
fix
Install frozendict: pip install frozendict
error ModuleNotFoundError: No module named 'frozendict' ↓
cause Neither frozendict nor types-frozendict are installed.
fix
Install frozendict: pip install frozendict; optionally install types-frozendict for type hints.
error Cannot find implementation or library stub for module 'frozendict' ↓
cause Missing types-frozendict type stubs; the module exists but mypy can't find stubs.
fix
Install types-frozendict: pip install types-frozendict
Warnings
deprecated types-frozendict is part of typeshed and may be deprecated in favor of inline types if the frozendict project adds its own types. ↓
fix Monitor frozendict releases; if inline types are added, remove types-frozendict dependency and use frozendict directly.
gotcha The stubs only cover frozendict's public API. Custom subclasses or advanced features may not be typed. ↓
fix Add custom type stubs if using advanced features not covered by types-frozendict.
gotcha frozendict is hashable only if all its values are hashable. The stubs do not enforce this at type-check time. ↓
fix Use mypy or pyright with custom checks if needed, or ensure values are hashable at runtime.
Imports
- frozendict wrong
import frozendictcorrectfrom frozendict import frozendict
Quickstart
from frozendict import frozendict
# Create a frozen dict
fd = frozendict({"key": "value"})
print(fd["key"]) # Output: value
# Type hint example
def process(d: frozendict[str, int]) -> None:
for k, v in d.items():
print(k, v)
process(frozendict({"a": 1, "b": 2}))