Is your feature request related to a problem? Please describe.
When PyCharm detects access to a missing field in a class, it offers to add this field.
For a pydantic model, this logic is currently broken.
Calling the intent on this example:
import pydantic
class M(pydantic.BaseModel):
...
def test_():
m = M()
assert m.new_field
leads to this code:
class M(pydantic.BaseModel):
def __init__(__pydantic_self__, **data: Any):
super().__init__(data)
__pydantic_self__.new_field = None
Describe the solution you'd like
Intercept the call and add field like it would be done in a pydantic way:
from typing import Any
class M(pydantic.BaseModel):
new_field: Any
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too