Read your YAML files easily
Project description
Simplify how you read configuration files using PyYAML
Installation
The library is available on PyPI and can be installed using pip:
pip install pyaml-object
Usage
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 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
Built Distribution
File details
Details for the file pyaml_object-2.0.1.post0.tar.gz
.
File metadata
- Download URL: pyaml_object-2.0.1.post0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.4 Linux/5.10.104-linuxkit
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13d01acccb3e9fd95c1660c11f7814e6e7cb9d683c90b3941e1b4386938cfddc |
|
MD5 | 19c3690e3cc37b912cd205034c8c499c |
|
BLAKE2b-256 | c753dc961351b9d3278e6b504a731141dc3c5ccead16f35fc98e32957a082324 |
File details
Details for the file pyaml_object-2.0.1.post0-py3-none-any.whl
.
File metadata
- Download URL: pyaml_object-2.0.1.post0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.4 Linux/5.10.104-linuxkit
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbf9b2187f6dc756f924122eb004f9632756086d805248a080c85f682078d467 |
|
MD5 | 4f8f4bceb1bd12970952565401c916b0 |
|
BLAKE2b-256 | 9917d2b1b8a5760a95848c11539cb16cefe4eaea295168e7cd677da7a07e6bec |