Skip to main content

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


Download files

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

Source Distribution

polyconf-0.1.0.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

polyconf-0.1.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file polyconf-0.1.0.tar.gz.

File metadata

  • Download URL: polyconf-0.1.0.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.0 Linux/6.3.7-zen1-1-zen

File hashes

Hashes for polyconf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8a036f6f36e43a055669b74938d12a46634d70f887e8af3da06790214deb8c18
MD5 3a6540d26f35f360473fb672e319aed2
BLAKE2b-256 6427873e5a2090f0ed6710568360eb16abf70466420c7e040b249f86d4eebaca

See more details on using hashes here.

File details

Details for the file polyconf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: polyconf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.0 Linux/6.3.7-zen1-1-zen

File hashes

Hashes for polyconf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88cd25123095c76469e5460ff24ea96072724dab5e3f6f490a94b1fe175fab84
MD5 e30a1c612af6b0162fe4df476cd2aeff
BLAKE2b-256 824c47898ffcd53561ae90f4cc9323d411b2ba16b99247e85056a58f338f056d

See more details on using hashes here.

Supported by

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