Load YAML configuration respecting XDG
Project description
configize
Python library to find and fetch YAML configuration for a program, respecting the XDG base directory specification.
Example
from configize import configize
# This will use $XDG_CONFIG_HOME
# The following files will be searched for, and the first existing file will be used:
# (Note, NAME is populated from the class kwarg 'Name')
# - $XDG_CONFIG_HOME/NAME.yaml
# - $XDG_CONFIG_HOME/NAME.yml
# - $XDG_CONFIG_HOME/NAME/NAME.yaml
# - $XDG_CONFIG_HOME/NAME/NAME.yml
# - $XDG_CONFIG_HOME/NAME/config.yaml
# - $XDG_CONFIG_HOME/NAME/config.yml
c = configize(Name="myproject")
# Alternatively, if using a custom path instead of XDG:
c = configize(Name="myproject", Path="/etc/myproject")
# the path field contains a pathlib.Path object to the config file
print(c.path)
# the config field contains a deserialized dict from the YAML file contents
print(c.config)
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
Configize-1.0.1.tar.gz
(26.0 kB
view hashes)
Built Distribution
Configize-1.0.1-py3-none-any.whl
(26.4 kB
view hashes)
Close
Hashes for Configize-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 761f34181b27f16aeeb7a55b561d49be6ebedf90b5f49ded175cef36f1f1f531 |
|
MD5 | c70c2be723c410404d074fc2e62dc1a0 |
|
BLAKE2b-256 | b19c9c727b08170c350d054495245620a8e3a9e040563793720ba69e1375cc32 |