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
ez_yaml_config-0.4.2.tar.gz
(6.1 kB
view details)
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.2.tar.gz.
File metadata
- Download URL: ez_yaml_config-0.4.2.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8443345e66e97ff4dd5cf5f80b80709424e6a458543375ce6f25f4db986847b1
|
|
| MD5 |
798168bc894cd77a7c6f9fa885fcb987
|
|
| BLAKE2b-256 |
5d2a1601484fc786f8d98893160c973b93725188254e0de5cf0d05bae0ec56e8
|
File details
Details for the file ez_yaml_config-0.4.2-py3-none-any.whl.
File metadata
- Download URL: ez_yaml_config-0.4.2-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 |
32bb13f8abebdd84caa89024a10eb1ccc619544c8527589d8d689a7680ed4e2e
|
|
| MD5 |
659afb81ef76f3fee9be7ee0585c787f
|
|
| BLAKE2b-256 |
d05f8783e114e6527f8749cbf3213ec7ece0b8e7e13c0185558732dc06fdb91c
|