8000 mypy v1.11.0 crashing with `--pretty` and shows errors for union syntax · Issue #349 · pydantic/pydantic-settings · GitHub
[go: up one dir, main page]

Skip to content

mypy v1.11.0 crashing with --pretty and shows errors for union syntax #349

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

Closed
setu4993 opened this issue Jul 22, 2024 · 6 comments
Closed
Assignees

Comments

@setu4993
Copy link

Cross-post from the issue python/mypy#17535

I'm not sure if this is a pydantic / mypy issue with my (lack of) familiarity for implementation on both of them.

Even a simple example like this causes it to be reproduced:

from pydantic_settings import BaseSettings

class Foo(BaseSettings):
    pass
@dmontagu
Copy link
Contributor
dmontagu commented Jul 22, 2024

Are you using the pydantic mypy plugin? If not, happy to look into this, but it's probably a bug in mypy.

@dmontagu
Copy link
Contributor

I'll note that I can't reproduce this with or without the mypy plugin, at least using the main branch of pydantic. Could you share what version of pydantic and pydantic_settings you are able to reproduce this with?

@dmontagu
Copy link
Contributor

Okay, I can reproduce this if using python <=3.9 (presumably because that version of python doesn't support the X | Y syntax, but that syntax is used in pydantic-settings). The fact that this doesn't error with mypy==1.10.0 makes me think this is a mypy bug.

@setu4993
Copy link
Author

Agreed, it does seem like a mypy bug that started in v1.11.0, with Python 3.9 and the latest release versions of pydantic and pydantic-settings.

If you have any clues on what could be causing this only with BaseSettings but not with BaseModel, that'd be very much appreciated.

@hramezani
Copy link
Member

close the issue because it seems it is not a pydantic-settings issue
Thanks @setu4993 for reporting and @dmontagu for investigating.

@setu4993
Copy link
Author

That's fair. Thanks @dmontagu and @hramezani.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0