-
-
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
Compatibility Issue with Pydantic 2 #726
Comments
If anyone is interested in a workaround with monkeypatch: import pydantic
from pydantic_settings import BaseSettings
pydantic.BaseSettings = BaseSettings
class AppContainer(containers.DeclarativeContainer):
config = providers.Configuration(strict=True)
env = providers.Configuration(strict=True, pydantic_settings=[env_secrets])
... |
You do not really need to monkeypatch anything: -container.config.from_pydantic(settings)
+container.config.from_dict(settings.model_dump())
|
Hey @rmk135, |
Is this package maintained? |
@abdalazizrashid seems like no. You can switch to my fork, but only python3.12 compatibility was introduces compared to original repo. |
Hi all! I looked into this issue today. I have a working example with |
FYI all, there has been a nice PR already created for this: #768 (comment) It has some merge conflicts, but we can make it work one way or another. |
The major version of
Pydantic
was recently released and lost backward compatibility. In particular, the.from_pydantic
method stopped working forproviders.Configuration
due to the fact that theBaseSettings
class now needs to be imported from a new package calledpydantic-settings
.The text was updated successfully, but these errors were encountered: