Skip to main content

dconf

or DotConf

Make Config Great Again.

Easy dot representation configuration module to make config life better.

How to use

Example:

config.toml

title = "TOML Example"

[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00-08:00

[database]
enabled = true
ports = [ 8000, 8001, 8002 ]
data = [ ["delta", "phi"], [3.14] ]
temp_targets = { cpu = 79.5, case = 72.0 }

[servers]

[servers.alpha]
ip = "10.0.0.1"
role = "frontend"

[servers.beta]
ip = "10.0.0.2"
role = "backend"

[[products]]
name = "Hammer"
sku = 738594937

[[products]]
name = "Nail"
sku = 284758393
>>> import tomli
... from dotconfig import DotConfig
... CONFIG = DotConfig()
... CONFIG.load(tomli.load, "config.toml")
>>> CONFIG
{'title': 'TOML Example', 'owner': {'name': 'Tom Preston-Werner', 'dob': datetime.datetime(1979, 5, 27, 7, 32, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=57600)))}, 'database': {'enabled': True, 'ports': [8000, 8001, 8002], 'data': [['delta', 'phi'], [3.14]], 'temp_targets': {'cpu': 79.5, 'case': 72.0}}, 'servers': {'alpha': {'ip': '10.0.0.1', 'role': 'frontend'}, 'beta': {'ip': '10.0.0.2', 'role': 'backend'}}, 'products': [{'name': 'Hammer', 'sku': 738594937}, {'name': 'Nail', 'sku': 284758393}]}
>>> CONFIG.title
'TOML Example'
>>> CONFIG.database.ports
[8000, 8001, 8002]
>>> CONFIG.database.temp_targets.cpu
79.5
>>> CONFIG.servers
{'alpha': {'ip': '10.0.0.1', 'role': 'frontend'}, 'beta': {'ip': '10.0.0.2', 'role': 'backend'}}
>>> CONFIG.servers.alpha.role
'frontend'
>>> CONFIG.products
[{'name': 'Hammer', 'sku': 738594937}, {'name': 'Nail', 'sku': 284758393}]
>>> CONFIG.products[0].sku
738594937

Another way to load the configuration

>>> config = {'alpha': {'ip': '10.0.0.1', 'role': 'frontend'}, 'beta': {'ip': '10.0.0.2', 'role': 'backend'}}
... CONFIG = DotConfig(config)
>>> CONFIG.beta.ip
'10.0.0.2'

Contribute

Feel free to fork and pr.

Metadata

Release files for dconf 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 dconf 0.0.3
File Size Uploaded Provenance Actions
dconf-0.0.3.tar.gz 3.3 kB Without provenance Details for dconf-0.0.3.tar.gz

Release files / dconf-0.0.3.tar.gz

Download URL dconf-0.0.3.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
af7296c72d4363fe61294cf05eb52d8f26efdf436f6059e02a4792a4490450f2
BLAKE2b-256 checksum
How to use checksums
a2bee42ad5b1a0fab0717eee541588f13c202f9a6e5212b8d4017f144c233124
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

Security for dconf 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.

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file No provenance

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