Skip to main content

Recursively update nested dictionaries with another dictionary

Project description

deep-dict-update

A Python package for recursively updating nested dictionaries with the content of another dictionary.

Installation

You can install deep-dict-update via pip:

pip install deep-dict-update

Usage

from deep_dict_update import deep_dict_update

orig_dict = {
    'data': [
        {'id': 1, 'name': 'Alice'},
        {'id': 2, 'name': 'Bob'}
    ]
}

new_dict = {
    'data': [
        {'id': 3, 'name': 'Charlie'},
        {'id': 4, 'name': 'David'}
    ]
}

updated_dict = deep_dict_update(orig_dict, new_dict)
print(updated_dict)

Output

{
    'data': [
        {'id': 3, 'name': 'Charlie'},
        {'id': 4, 'name': 'David'}
    ]
}

Contributing

Contributions are welcome! For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deep_dict_update-0.1.4.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

deep_dict_update-0.1.4-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file deep_dict_update-0.1.4.tar.gz.

File metadata

  • Download URL: deep_dict_update-0.1.4.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.8 Darwin/22.5.0

File hashes

Hashes for deep_dict_update-0.1.4.tar.gz
Algorithm Hash digest
SHA256 ca2fa22f7819eaaf35f73251ccf634db190b8ad7d0fdd7d12bd55d6ce83cefc1
MD5 6a8e655e18a9cde4a32a2065cb0c1b53
BLAKE2b-256 44702816290e2723c9e74b8b0a92da5c3d26a6ae6764e9fff7b9a21ba8a5a2d0

See more details on using hashes here.

File details

Details for the file deep_dict_update-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for deep_dict_update-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9e76b07b2a4fa579c28b64e6ccff3298e47ae93eb16a9ab83e039e00fd9f0771
MD5 a988a9a710ab4cd117ef3452405ff7c1
BLAKE2b-256 2f5c6397dfbc4224bc8f96344063b35db5f1221807fa4a9eb98e34a91177c57f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page