Skip to main content

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.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ez_yaml_config-0.4.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file ez_yaml_config-0.4.1.tar.gz.

File metadata

  • Download URL: ez_yaml_config-0.4.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.3

File hashes

Hashes for ez_yaml_config-0.4.1.tar.gz
Algorithm Hash digest
SHA256 4a65ae44ec84b24bfd341d8164d75d30d1fe3d41fa7da74307e7b09354f3d5c1
MD5 eed1d21791eb3e22f2ffc23f30e10cd8
BLAKE2b-256 d298ec0ef202c077b70b1053879264478207a33337dead1b02ef330e8ff91c4a

See more details on using hashes here.

File details

Details for the file ez_yaml_config-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ez_yaml_config-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d06805fd6c87b95c0bfe133844569040221ef03ee0ce08f8bfc4ae541387784c
MD5 d7e7088e85b620a85fcfcd725bc73ebd
BLAKE2b-256 ded7f2e02ebd56bcec18257b3989d6054999e3bb02334a1e4f3c74cdd8c50004

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page