-
-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Describe the bug
If a field in a Pydantic dataclass has a kw_only=True param, then PyCharm shows a hint/underline without a message, and the Alt+Enter actions popup says "Insert required arguments".
However, this does not happen for a class which inherits Pydantic's BaseModel.
Further, the underline exists but there's no warning in the 'Problems' tab. Only shows up when pressing Alt+Enter (on Windows).
Note: When I disable the plugin, the issue stops. That incorrect warning highlight and pop-up don't appear.
To Reproduce
Steps to reproduce the behavior:
- Using this example code
from pydantic.dataclasses import dataclass as pyd_dataclass
from pydantic import Field, BaseModel
@pyd_dataclass
class MoreParams:
value: str | None = Field(None, kw_only=True)
smp = MoreParams(value="val") # warning underline here
class OkayParams(BaseModel):
value: str | None = Field(None, kw_only=True)
okp = OkayParams(value="val") # this is okay- There will be a dark-orange/red underline near the
)at the end ofsmp = MoreParams(value="val") - Mouse-over it (nothing happens)
- Press Alt+Enter (windows) and we get a pop up/hint for "Insert required arguments"
Expected behavior
- Should not be an inspection error.
- And inspection errors should also show up in the 'Problems' tab, whether they are correct or not.
Screenshots
Environments:
- IDE: PyCharm 2024.3.5 (Professional Edition)
- OS: Windows10
- Pydantic Version 2.11.3
- Plugin version 0.4.16
Metadata
Metadata
Assignees
Labels
No labels


