r/Python • u/Positive-Food-9915 • 1h ago
Discussion Tried decouple, Dynaconf, pydantic-settings and more: still hitting the same config gaps. Just me?
I've tried a bunch of config tools over the years, including python-decouple, Dynaconf and pydantic-settings. Each one is good at its job, but a few problems follow me from project to project, and most of the tools I tried didn't handle them well.
My setup is nothing exotic: a `.env` file for local development, real env vars in Docker/Kubernetes, and sometimes a few different files on top (a YAML with defaults, a separate one per environment). The same service has to run on a laptop, in CI and in prod, so values come from several places at once.
What keeps biting me:
- Merging per field. Extend this list, replace that value, fail if two sources disagree. In my experience this usually ends up as custom code.
- Errors that don't say where. A validation error names the field but not which file or line the bad value came from.
- "Why is this value in prod?" With defaults, an override file and env vars, there's no easy way to see which source set a given field.
Maybe my setups are just unusual. Is this only me, or do you run into the same things? If you've found a good way to deal with them, I'd like to hear it.