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'}
Metadata
Release files for pyaml-object 2.0.1.post0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyaml_object-2.0.1.post0.tar.gz | 4.0 kB | Without provenance | Details for pyaml_object-2.0.1.post0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyaml_object-2.0.1.post0-py3-none-any.whl | Python 3 | none | any | Details for pyaml_object-2.0.1.post0-py3-none-any.whl |
Total release size: 9.0 kB
Release files / pyaml_object-2.0.1.post0.tar.gz
| Download URL | pyaml_object-2.0.1.post0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
13d01acccb3e9fd95c1660c11f7814e6e7cb9d683c90b3941e1b4386938cfddc
|
|
BLAKE2b-256 checksum How to use checksums |
c753dc961351b9d3278e6b504a731141dc3c5ccead16f35fc98e32957a082324
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.4 Linux/5.10.104-linuxkit
|
Release files / pyaml_object-2.0.1.post0-py3-none-any.whl
| Download URL | pyaml_object-2.0.1.post0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dbf9b2187f6dc756f924122eb004f9632756086d805248a080c85f682078d467
|
|
BLAKE2b-256 checksum How to use checksums |
9917d2b1b8a5760a95848c11539cb16cefe4eaea295168e7cd677da7a07e6bec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.4 Linux/5.10.104-linuxkit
|
Security for pyaml-object 2.0.1.post0
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.