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
Fix handling of optionals in mypy plugin #9008
Conversation
Deploying pydantic-docs with Cloudflare Pages
|
748d46d
to
ded66e1
Compare
CodSpeed Performance ReportMerging #9008 will not alter performanceComparing Summary
|
Is there a test case we should add here? Also, I wonder, should we be setting a minimum supported version of mypy for the plugin? I don't know if it's practical for us to throw an exception if the mypy version is too old? |
I think it would make sense to drop some older versions of mypy, especially because before around 1.1 support for |
1.1.1 is a year old, so that might be a suitable cutoff point. Or we could try to go further, 1.5.1 is 6 months old. It would be nice with either limit if we could fail gracefully if users try an older mypy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks @dmontagu
I have added a test, but I'll note that the only affected version that we test against is mypy 1.5.1 (and we install 1.1.1 by default in pydantic). We should probably update the versions we test against soon. I'm not prepared to do that in this PR though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just marking as 'awaiting author revision` until the tests are passing 👍
Great, thank you very much @dmontagu !! |
I think this may resolve various occurrences of mypy issues with optional, such as #9007
Mirrors the changes to the dataclasses plugin in python/mypy#15571
Fix #9007
Fix #8760