Skip to main content

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)

Source distribution for ez-yaml-config 0.4.2
File Size Uploaded
ez_yaml_config-0.4.2.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ez-yaml-config 0.4.2
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page