-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
WIP for MyPy CI Integration #25622
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
WIP for MyPy CI Integration #25622
Changes from 1 commit
f46e165
d358ab5
db12d9f
b77347a
4c68a7b
caec323
fb987f4
9b5daaa
d169cb6
2abc6f5
2807e00
fb41b5f
ac7e768
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[mypy] | ||
follow_imports=silent | ||
|
||
[mypy-numpy.*] | ||
ignore_missing_imports=True | ||
|
||
[mypy-pandas._libs.*] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generally doesn't look like Mypy likes Cython imports. Have this in the config but also noted specifically on imports within the code. There's probably a better approach to this just haven't found yet There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the PEP, you should be able to use .pyi/stub files to annotate compiled extensions. Not ideal though since they'd have to stay in-sync with the extension |
||
ignore_missing_imports=True |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
pandas/core/dtypes/base.py | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are all of the files that currently have some sort of hints in them. The motivation for this comes form this part in the documentation: https://mypy.readthedocs.io/en/latest/running_mypy.html#reading-a-list-of-files-from-a-file So thinking for initial CI runs we can whitelist the modules we want to run against, though this is ideally just a temporary file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be clear when running this from the project root you would do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Naddiseo any chance you have experience with this? Reading from docs I think suggested approach will be to whitelist particular modules at the outset and slowly open up as more are added. I'd like to avoid having two files to control configuration here but I don't see an easy way in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WillAyd, not with the whitelist approach. I went with the blacklist approach instead, and had a bunch of modules and packages with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the feedback. Was that done per package / module in the config file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently I'm just ignoring packages. But, I think at one point I was doing both, and I seem to remember doing a mixture where I'd ignore everything in a package except a specific file. [mypy-package.subpackage]
ignore_errors=True
[mypy-package.subpackage.module]
ignore_errors=False However, I don't remember if it worked or not. |
||
pandas/core/groupby/groupby.py | ||
pandas/core/internals/blocks.py | ||
pandas/core/internals/managers.py | ||
pandas/core/common.py | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this not possible in the setup file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea I was hoping that With that said this may just be temporary anyway - would ideally like to run on the entire code. Modules without existing types would be ignored by default anyway |
||
pandas/core/arrays/datetimes.py | ||
pandas/core/arrays/integer.py | ||
pandas/core/arrays/period.py | ||
pandas/core/arrays/sparse.py | ||
pandas/core/arrays/datetimelike.py | ||
pandas/core/arrays/array_.py | ||
pandas/core/arrays/base.py | ||
pandas/core/frame.py | ||
pandas/core/base.py | ||
pandas/core/indexes/period.py | ||
pandas/core/indexes/datetimelike.py | ||
pandas/core/indexes/base.py |
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.
This is less than ideal but without this the errors are out of control. My motivation for setting this comes from the Mypy documentation:
https://mypy.readthedocs.io/en/latest/running_mypy.html#following-imports
To wit: