godlib
Recursive merge for nested dictionaries. Config files layered over defaults is the usual reason to need this.
Install
pip install godlib
Usage
from godlib import deep_merge, ListMode
base = {"db": {"host": "localhost", "port": 5432}, "tags": ["a"]}
over = {"db": {"port": 6543}, "tags": ["b"]}
deep_merge(base, over)
# {'db': {'host': 'localhost', 'port': 6543}, 'tags': ['b']}
deep_merge(base, over, n_list=ListMode.APPEND)
# {'db': {'host': 'localhost', 'port': 6543}, 'tags': ['a', 'b']}
Behaviour
| Case | Result |
|---|---|
| both sides dict | merged recursively |
| both sides list | depends on n_list |
| anything else | value from the override wins |
| key only in base | kept |
| key only in override | added |
Inputs are deep-copied, never mutated.
License
MIT
Metadata
Release files for godlib 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| godlib-0.0.2.tar.gz | 2.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| godlib-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.3 kB
Release files / godlib-0.0.2.tar.gz
| Download URL | godlib-0.0.2.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f46aa43d3a5c17b906f5c5c9c75175803a72a3648bdd9427f2530ab3aec07b6f
|
|
BLAKE2b-256 checksum How to use checksums |
127819417028d17f77161f54cb4d9b893084527beb96c0a0de15c7933e601e5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.11
|
Release files / godlib-0.0.2-py3-none-any.whl
| Download URL | godlib-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d53c4061981bb881d70d79fa64208ecb7f3314fd1cbf889dc0805b254dad0257
|
|
BLAKE2b-256 checksum How to use checksums |
c706d947d7fffe9fbdf811f6aa5f34679f49c1058a67b58eb740222e449498af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.11
|
Security for godlib 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.