Skip to main content

godlib

English | 中文

嵌套字典递归合并,可选列表拼接策略。

安装

pip install godlib

用法

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']}
decode = deep_merge(base, over, n_list=ListMode.APPEND)
# {'db': {...}, 'tags': ['a', 'b']}

说明

两边都是 dict 时递归合并,其余类型由覆盖值胜出;n_list 决定列表是替换、追加还是前置;入参全程深拷贝,不会改动调用方的对象。

许可证

MIT


English

Recursive dict merge with explicit list handling.

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']}
decode = deep_merge(base, over, n_list=ListMode.APPEND)
# {'db': {...}, 'tags': ['a', 'b']}

Notes

Nested dicts merge recursively; every other type is taken from the override. n_list decides whether lists replace, append or prepend. Inputs are deep-copied, never mutated.

License

MIT

Metadata

Release files for godlib 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for godlib 0.0.3
File Size Uploaded Provenance
godlib-0.0.3.tar.gz 3.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for godlib 0.0.3
File Interpreter ABI Platform
godlib-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 6.9 kB

Release files / godlib-0.0.3.tar.gz

Download URL godlib-0.0.3.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d8cd744531de1fe140bc81b975f245b2675fff2c9af3b11e4b6e6cd6eee95ac5
BLAKE2b-256 checksum
How to use checksums
49371d36f4a57830dc46c39ffae96e02d6fe8bd89f3182ad27d8471e8d147dd3
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.3-py3-none-any.whl

Download URL godlib-0.0.3-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6985e9c3eab57aaf71bc9d8b6312e7a03c024f915a006f7ac15d51db31b4a2d9
BLAKE2b-256 checksum
How to use checksums
e75ec97aac06c5c6c26bf62c85bd14a3559e429573915460de21b4877f090647
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.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page