-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Packaging
Context
Users configuring MongoClient from environment variables or .env files today do it by hand, with no validation or type coercion. Design gist: https://gist.github.com/blink1073/0d8cd1af7934eb6e0902603cb350068f
Definition of done
An optional pymongo[settings] extra is available that provides a typed, validated settings model (built on pydantic-settings) for configuring MongoClient/AsyncMongoClient from environment variables or .env files. The extra is opt-in and adds no hard dependency to core PyMongo.
Pitfalls
Avoid colliding with the existing internal pymongo/synchronous/settings.py and pymongo/asynchronous/settings.py modules, which are unrelated. Keep the field set curated rather than mirroring every MongoClient option, to limit future maintenance burden as options evolve.