Skip to content

Utils

Settings

Bases: BaseSettings

Settings class for the application.

Source code in src/python_package_template/utils.py
12
13
14
15
16
17
18
19
20
21
22
class Settings(BaseSettings):
    """Settings class for the application."""

    # if .env is present, it will override the environment variables
    model_config = SettingsConfigDict(env_file=".env", extra="ignore")

    # use .get_secret_value() to get the value
    EXAMPLE_API_KEY: Optional[SecretStr] = Field(default=None, description="the api key")
    EXAMPLE_ENDPOINT: Optional[str] = Field(default=None, description="the endpoint")

    DEV_MODE: bool = False