Typed config files
Project description
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
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ez_yaml_config-0.4.0.tar.gz.
File metadata
- Download URL: ez_yaml_config-0.4.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7fd1b3ef3ad6b9dcf7e59a830471f392d9fdac4e2dfe6a40474d771d088837d
|
|
| MD5 |
552e7c0763032c1600d737813cc4321a
|
|
| BLAKE2b-256 |
2580d716e5bff796ae18681ab86cbcf4d5258abe5c97cd3584335eacb3d46173
|
File details
Details for the file ez_yaml_config-0.4.0-py3-none-any.whl.
File metadata
- Download URL: ez_yaml_config-0.4.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c26d12bf9da5240c1ef96d9e524e9d4b02b6dee38ee04a6dad64db876ba5112
|
|
| MD5 |
8226d0860ddf6ba79ba2fc76722e43bf
|
|
| BLAKE2b-256 |
9f2e378c97208ff335b97324e6e5ce3871fbc20667442d362ff568e9658f64c1
|