pydantic-settings icon indicating copy to clipboard operation
pydantic-settings copied to clipboard

when call Settings() the pyright report missing argument

Open braindevices opened this issue 5 months ago • 1 comments

from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings3(BaseSettings):
    model_config = SettingsConfigDict(cli_parse_args=True)
    foobar: str = "default"
    b: int # required

Settings3() # this line cause problem, pyright expect the b, but in basesetting this is valid.

pyright report error: Argument missing for parameter "b" (reportCallIssue) Same code can pass mypy without issue.

I wonder if you know anything about why pyright behave like this, should we report a bug in their repo or is this some behavior debatable?

braindevices avatar Sep 06 '24 19:09 braindevices