Read your YAML files easily
Project description
Simplify how you read configuration files using PyYAML
Having a service.yaml
file such:
service:
version: 1.0.0
name: myservice
secret_key: XXXXXX
We can read the config file through the Config API by applying the read method.
from pyyaml_object.config import Config
conf_manager = Config('service.yaml')
conf = conf_manager.read()
Now we have a conf
object that embedes every key and value from our yaml file. For instance, we can reconstitute a constant SETTING
variable such:
SETTINGS = {
'VERSION': conf.service.version,
'NAME': conf.service.name,
'SECRET_KEY': conf.service.secret_key
}
print(SETTINGS)
#{'VERSION': '1.0.0', 'NAME': 'myservice', 'SECRET_KEY': 'XXXXXX'}
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
pyaml_object-1.0.1.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for pyaml_object-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90d5ad9dcf027ffdee9daccfc6f67248c98423ff8a62a14bc6d9b5696ec7ea9f |
|
MD5 | 4264e43e1558680797b9b0b932ab71f6 |
|
BLAKE2b-256 | 8e3def17967ada6a34e3a64e42f84ba5b9f17245b97f81fa2a9ec1cad5048fcc |