Install with pip install ez-yaml-config
Then define some configuration files like so:
from config import Configuration, gsm_secret
class ConfigBase(Configuration):
CONFIG_FILE = "settings.yaml"
CONFIG_FILE_PATH_ENV_VAR = "SETTINGS_PATH"
class LoggingConfig(ConfigBase):
CONFIG_SECTION = "logging"
level: Literal["info", "warning", "error"]
class BackendConfig(ConfigBase):
CONFIG_SECTION = "server"
host: str
api_key: Annotated[str, gsm_secret(project="my-gcp-project")]
The above Configurations will load a file named settings.yaml in the cwd, or from the location set in the SETTINGS_PATH environment variable (if its been set). The file should look like this:
logging:
level: info
server:
host: "localhost"
api_key: gsm:name-of-gsm-key
Metadata
Release files for ez-yaml-config 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ez_yaml_config-0.4.2.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ez_yaml_config-0.4.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.5 kB
Release files / ez_yaml_config-0.4.2.tar.gz
| Download URL | ez_yaml_config-0.4.2.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8443345e66e97ff4dd5cf5f80b80709424e6a458543375ce6f25f4db986847b1
|
|
BLAKE2b-256 checksum How to use checksums |
5d2a1601484fc786f8d98893160c973b93725188254e0de5cf0d05bae0ec56e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.3
|
Release files / ez_yaml_config-0.4.2-py3-none-any.whl
| Download URL | ez_yaml_config-0.4.2-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
32bb13f8abebdd84caa89024a10eb1ccc619544c8527589d8d689a7680ed4e2e
|
|
BLAKE2b-256 checksum How to use checksums |
d05f8783e114e6527f8749cbf3213ec7ece0b8e7e13c0185558732dc06fdb91c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.3
|