Configuration Files
TOML Format
config.toml:
database_url = "postgres://localhost/prod"
debug = false
workers = 8
YAML Format
Install: uv add pyyaml
config.yaml:
database_url: postgres://localhost/prod
debug: false
workers: 8
.env Format
Install: uv add python-dotenv
.env:
DATABASE_URL=postgres://localhost/prod
DEBUG=false
WORKERS=8
Auto-Discovery
load_settings() checks in order:
~/.config/config/config.tomland~/.config/config/config.yaml./config.tomland./config.yaml- Files in
./config/matching*.toml,*.yaml,*.yml ./.env
With App Name
settings, _ = load_settings(Config, app_name="myapp")
Checks:
1. ~/.config/myapp/myapp.toml and ~/.config/myapp/myapp.yaml
2. ./myapp.toml and ./myapp.yaml
3. Files in ./config/ matching *.toml, *.yaml, *.yml
4. ./.env