Skip to main content

layered configuration aggregator

Project description

Load and merge nested configurations.

Usage

Installation:

python -m pip install overdub

With these structures:

from overdub import MutableOverdub

a = {'foo': 1, 'bar': {'baz': 2}, 'qux': {'one': 1}}
b = {'foo': 3, 'bar': {'baz': 4}, 'qux': {'two': 2}}

Update:

overdubbed = MutableOverdub(a)
overdubbed.update(b)
assert overdubbed.foo == 3
assert overdubbed.bar.baz == 4
assert overdubbed.qux == {'two': 2}

Merge:

overdubbed = MutableOverdub(a)
overdubbed.merge(b)
assert overdubbed.foo == 3
assert overdubbed.bar.baz == 4
assert overdubbed.qux == {'one': 1, 'two': 2}

Rebase:

overdubbed = MutableOverdub(a)
overdubbed.rebase(b)
assert overdubbed.foo == 1
assert overdubbed.bar.baz == 2
assert overdubbed.qux == {'one': 1, 'two': 2}

Unbound the data:

overdubbed = MutableOverdub(a)
assert isinstance(overdubbed, Overdub)
naked = MutableOverdub(a)
assert not isinstance(naked, Overdub)

Freeze configuration:

overdubbed = overdubbed.frozen()

YAML files

It can also read configuration from yaml files, for this install:

python -m pip install overdub[yaml]

And then, merge all files:

from overdub import yaml

overdubbed = yaml.load_from_file('a.yml', b.yml')
assert overdubbed.foo == 3
assert overdubbed.bar.baz == 4
assert overdubbed.qux == {'one': 1, 'two': 2}

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

overdub-0.7.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

overdub-0.7-py2-none-any.whl (8.9 kB view details)

Uploaded Python 2

File details

Details for the file overdub-0.7.tar.gz.

File metadata

  • Download URL: overdub-0.7.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for overdub-0.7.tar.gz
Algorithm Hash digest
SHA256 d1a660afc71d408312b0b06932c9c9c6285bec86f48a17b68e1bf1dee395c9c7
MD5 f81299637612034a52c842ffe5b1c306
BLAKE2b-256 71c19f0765f666143bede020394c784a74dd41d5a8352a8f896d6ee1d1f1c3f4

See more details on using hashes here.

File details

Details for the file overdub-0.7-py2-none-any.whl.

File metadata

File hashes

Hashes for overdub-0.7-py2-none-any.whl
Algorithm Hash digest
SHA256 b229fc927b4e5341231ef347d183a0820173e367e6ec859f04c2c9157795f48c
MD5 84c7ec3e93de67600374aec96bdabe36
BLAKE2b-256 04c92b2911524b24df5f9037c22809608ddaac08b715179d69dd88452708cac5

See more details on using hashes here.

Supported by

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