Registry / serialization / dict-deep

dict-deep

JSON →
library4.1.2pypypi✓ verified 85d ago

A lightweight library providing deep_set and deep_get functions to access nested dictionaries (or any object) using dot-notation strings. Current version 4.1.2, Python >=3.5,<4.0. Maintained but infrequent releases.

pip install dict-deep
INSTALL
IMPORT
SIG · DICT-DEEP
D
dict-deep
serializationpythonv4.1.2
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.1.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

deep_get
from dict_deep import deep_get
from dictdeep import deep_get
Package name uses underscore, not hyphen.
deep_set
from dict_deep import deep_set
from dict_deep import deep_set (same as correct, no common wrong import for this symbol)

Demonstrates basic deep_get and deep_set with dot-notation strings.

from dict_deep import deep_get, deep_set nested = {'a': {'b': {'c': 42}}} # Get value using dot-separated key val = deep_get(nested, 'a.b.c') print(val) # 42 # Set value using dot-separated key deep_set(nested, 'a.b.c', 99) print(nested['a']['b']['c']) # 99
Debug
Known issues
gotchadeep_set modifies the original dict in place; it does not return a new dict.
fix
Be aware that the original dict is mutated. If you need immutability, deepcopy before calling.
affects: all
gotchaKeys with dots in them are ambiguous: 'a.b' in dot-notation will be interpreted as a path, not a literal key.
fix
Use a list of keys instead of a dotted string when keys contain dots: deep_get(d, ['a.b'])
affects: all
deprecateddeep_update was removed in v4.0. Use deep_set or manual update instead.
fix
Replace deep_update calls with deep_set for individual keys, or use dictionary update methods.
affects: >=4.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'dict_deep'
Attempting to import using hyphen in the package name: 'import dict-deep' is invalid.
fix
Use the correct import: from dict_deep import deep_get
TypeError: 'int' object is not subscriptable
deep_set tries to traverse into an existing leaf value (e.g., an integer) to create nested dicts, but it can't override a non-dict.
fix
Ensure that intermediate keys point to a dict or are not set as leaf values before calling deep_set.
Upgrade
Version history
4.1.2latest on PyPI · released Apr 19, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
dict-deep — pip install dict-deep · libregistry