dict-recursive-update

raw JSON →
1.0.1 verified Fri May 01 auth: no python maintenance

A lightweight Python library for recursively updating nested dictionaries. Version 1.0.1 supports merging dict-like objects with customizable merge strategies. Currently in maintenance mode with no recent updates.

pip install dict-recursive-update
error AttributeError: 'list' object has no attribute 'keys'
cause Attempting to use recursive_update on a dictionary that contains lists as values.
fix
Ensure that nested values are dictionaries, not lists. If you need to merge lists, implement a custom strategy.
error ImportError: cannot import name 'recursive_update' from 'dict_recursive_update'
cause Wrong import path; the function is not in a submodule.
fix
Use: from dict_recursive_update import recursive_update
gotcha The function mutates the first argument in-place. Always pass a copy if you want to preserve the original.
fix Use recursive_update(d1.copy(), d2) instead of recursive_update(d1, d2).
gotcha Only works with dict-like objects. Passing lists or other iterables will raise an AttributeError.
fix Ensure all nested structures are dictionaries or implement the dict interface.
deprecated The package has no active development since 2019. Consider alternatives like deepmerge or dictdiffer for ongoing maintenance.
fix Migrate to deepmerge (pip install deepmerge) for better features and support.

Deep merge d2 into d1, modifying a copy to avoid side effects.

from dict_recursive_update import recursive_update

d1 = {'a': 1, 'b': {'c': 2}}
d2 = {'b': {'d': 3}, 'e': 4}
merged = recursive_update(d1.copy(), d2)
print(merged)