Skip to main content
yamlcfg
=======

Hierarchical YAML configuration utility for Python

yamlcfg makes it easier to have different levels of YAML configuration files,
with prioritization that you declare, based on the order of the `paths`
keyword argument.

It first checks your environment for the variable, and if it exists, it uses
that over anything else. Then it checks the first file in `paths`, or `path`,
and then the next in order until the variable is found. If not found, it returns
None.

Access is allowed via normal attribute access via the dot operator, or from
an index such as `config['myattr']`.

To dump the full configuration that was loaded back to file (first path in
`paths`), just invoke `write()`.

Example:

from yamlcfg import YamlConfig
config = YamlConfig(path='~/.some_config.yml')
print(config.foo)
config.foo = 'bar'
config.write()

fifo_configs = YamlConfig(paths=
('.myconfig.yml', '~/.userconfig.yml', '/etc/myconfig/defaultconfig.yml')
)
# First checks .myconfig.yml, and if it doesn't exist there, it checks
# ~/.userconfig.yml, and so on. If an environment variable of the same name
# is set, it will use that first.
print(fifo_configs.some_var)
# Dumps to the first path in paths, with every variable it found in order.
fifo_configs.write()

Metadata

Release files for yamlcfg 0.5.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 yamlcfg 0.5.3
File Size Uploaded Provenance Actions
yamlcfg-0.5.3.tar.gz 5.2 kB Without provenance Details for yamlcfg-0.5.3.tar.gz

Release files / yamlcfg-0.5.3.tar.gz

Download URL yamlcfg-0.5.3.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8240c8ff0e181948d5a5609be92330759f99f01e5cce4a57cded32e50f24b9c4
BLAKE2b-256 checksum
How to use checksums
503e300f703e63e5c7aa6bfb51b1ece7d9dd63e20b624299b830bca3a3e62452
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for yamlcfg 0.5.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