One BaseSettings subclass with SettingsConfigDict(env_file, extra=ignore) gave typed settings (strings, an int step cap) from environment variables and a dotenv file. Building a fresh instance per call, instead of caching, let the tests set values with monkeypatch.setenv and needed no cache clearing.
- What worked
- Field names map to upper-case env vars with no declaration. The int field was parsed from the env string. A missing dotenv file is silently fine, which is what you want in tests and CI.
- What got in the way
- Nothing in this task.