Gather and merge configuration from many sources.
Project description
PolyConf
Credit
The polyconf.core.deepmerge module is a heavy refactor of gh://toumorokoshi/deepmerge.
(More specifically, I based it on the tip of main at the time, which was commit 33a078ac7a29b63dfb91fea806cc6b96ede3fd23.)
I don't want this library to have 3rd party dependencies, so I basically stripped the dynamic configurability of deepmerge,
such that the behavior of always_merge() became the only behavior.
The keyword arguments are quite self-explanatory, so to concisely define the behavior, consider this snippet:
always_merger = Merger(
type_strategies=[
(list, "append"),
(dict, "merge"),
(set, "union"),
],
fallback_strategies=["override"],
type_conflict_strategies=["override"],
)
The refactor is heavy, indeed. At the time of this writing, cloc calculates it at only 22 lines of code.
However, I still want to give credit where it's due because there are a couple lessons in recursion
and fallback behavior that would have been painful to work out myself.
It also serves as a reminder for future reference because if I ever reverse the moratorium on 3rd party libs,
I'll happily depend on deepmerge directly.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polyconf-0.2.0.tar.gz.
File metadata
- Download URL: polyconf-0.2.0.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.0 Linux/6.4.6-zen1-1-zen
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd640a8b43befd7e8673df412150ff0559224ff184b4cc171ce2f8628d5a52af
|
|
| MD5 |
18f6d885b3edc57bcf325e98f74ce24b
|
|
| BLAKE2b-256 |
dc544debc403da0579ca600f6466a2a4bd21dd919d669591589c40e7d9b9cb19
|
File details
Details for the file polyconf-0.2.0-py3-none-any.whl.
File metadata
- Download URL: polyconf-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.0 Linux/6.4.6-zen1-1-zen
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f9f9c471790620b18a824b9189f717e7f8014b8b25f399a3e46e63bcc0eee22
|
|
| MD5 |
9eb97604363a9352d2520af9f6a143e3
|
|
| BLAKE2b-256 |
ef4436ef019e3ced66379f7e973dffcb5e97002137bc50fabd4d9b2da53db9af
|