Skip to main content
Bakebooks extend Pydantic’s BaseSettings, so every class attribute is typed, validated configuration:
Settings are loaded from environment variables, .env files, or defaults. Values are validated when the bakebook instantiates, so a bad value fails with a Pydantic error before any task runs: BAKE_PORT=99999 never reaches your task code.

Using settings in tasks

Tasks read settings as plain attributes, so configuration and the tasks that use it live in the same class:
Inherited bakebooks inherit configuration too, and subclasses can override individual fields (see Bakebook).

Secrets

Use SecretStr for sensitive values. They stay masked in bakefile env and bakefile export output until you explicitly pass --secret:

Getting settings out

bakefile env prints values or injects them into a command’s environment, and bakefile export writes them to shell, dotenv, JSON, or YAML. See the bakefile CLI.