-
-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support pydantic v2 BaseSettings #755
Comments
I created PR covering this issue. |
A work around that I used for this would be:
|
The same issue Temporary solved with:
|
FYI for anyone else who lands here: @cdonate's workaround is compatible with Pydantic v2. While @pow3rpi's workaround is technically compatible with Pydantic v2, the |
@bmcandr Good point! Thanks. |
In pydantic 2.0+ the
BaseSettings
class has been moved into a optional package, pydantic-settings. The configuration provider'sfrom_pydantic
method expect to find it in the pydantic package:https://github.com/ets-labs/python-dependency-injector/blob/master/src/dependency_injector/providers.pyx#L1806-L1816
This results in an error like:
Furthermore, the
BaseModel.dict
method used in the last line of this method is deprecated and has been replaced byBaseModel.model_dump
. The method still exists but emits deprecation warnings when accessed.The text was updated successfully, but these errors were encountered: