You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Even though from pydantic import BaseModel (in Pydantic v1 and v2) is supported, the import from pydantic.v1 import BaseModel does not seem to be supported by the Plugin
To Reproduce
Steps to reproduce the behavior:
Open PyCharm
Create a new file
Copy the following example:
frompydanticimportBaseModelclassPerson(BaseModel):
first_name: strlast_name: strjohn=Person() # Test position 1frompydantic.v1importBaseModelclassPerson2(BaseModel):
first_name: strlast_name: strjohn2=Person2() # Test position 2
Move the cursor inside the parenthesis of the init (john and john2) and press the key bind for basic code completion (Ctrl + Space)
Compare the behavior at those two positions --> See screenshots
Expected behavior
Parameter info and basic code completion for child classes of pydantic.v1.BaseModel - Behavior just like for Pydantic v1 and v2
Additional context
We are in the transition of our python package from pydantic v1 to pydantic v2. As suggested in the migration guide , we are using
frompydantic.v1importBaseModel
Unfortunately, the parameter info and basic code completion, available with BaseModel (imported via from pydantic import BaseModel from Pydantic v1 or v2), are not available anymore.
Temporary / Hacky workaround
For type checking to work in VS Code, we have created a decorator:
I have added a line to this decorator, with which the Pydantic Plugin works again, but the code checker outputs deprecation warning and other error associated with the migration from Pydantic v1 to v2.
I don't know if this is overly complex to fix / implement, but I would be incredibly happy to be able to use this awesome Plugin for our python package again!
Best regards, Lukas
The text was updated successfully, but these errors were encountered:
Describe the bug
Even though
from pydantic import BaseModel
(in Pydantic v1 and v2) is supported, the importfrom pydantic.v1 import BaseModel
does not seem to be supported by the PluginTo Reproduce
Steps to reproduce the behavior:
john
andjohn2
) and press the key bind for basic code completion (Ctrl + Space)Expected behavior
Parameter info and basic code completion for child classes of pydantic.v1.BaseModel - Behavior just like for Pydantic v1 and v2
Screenshots
Unexpected behavior / Bug:
Expected behavior:
Environments (please complete the following information):
Additional context
We are in the transition of our python package from pydantic v1 to pydantic v2. As suggested in the migration guide , we are using
Unfortunately, the parameter info and basic code completion, available with BaseModel (imported via
from pydantic import BaseModel
from Pydantic v1 or v2), are not available anymore.Temporary / Hacky workaround
For type checking to work in VS Code, we have created a decorator:
I have added a line to this decorator, with which the Pydantic Plugin works again, but the code checker outputs deprecation warning and other error associated with the migration from Pydantic v1 to v2.
I don't know if this is overly complex to fix / implement, but I would be incredibly happy to be able to use this awesome Plugin for our python package again!
Best regards, Lukas
The text was updated successfully, but these errors were encountered: