-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
Use mirrors-mypy for pre-commit #1291
Use mirrors-mypy for pre-commit #1291
Conversation
prefer df.drop(columns=...) syntax remove cautious 3.6 import for Literal Signed-off-by: Nathan McDougall <nmcdougall@tonkintaylor.co.nz>
Signed-off-by: Nathan McDougall <nmcdougall@tonkintaylor.co.nz>
black via pre-commit Signed-off-by: Nathan McDougall <nmcdougall@tonkintaylor.co.nz>
black formatting Signed-off-by: Nathan McDougall <nmcdougall@tonkintaylor.co.nz>
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1291 +/- ##
==========================================
+ Coverage 93.82% 93.84% +0.02%
==========================================
Files 90 90
Lines 6704 6698 -6
==========================================
- Hits 6290 6286 -4
+ Misses 414 412 -2
☔ View full report in Codecov by Sentry. |
@@ -357,7 +357,7 @@ def strict_filter_columns( | |||
) | |||
|
|||
if schema.strict == "filter": | |||
check_obj = check_obj.drop(*filter_out_columns) | |||
check_obj = check_obj.drop(columns=filter_out_columns) |
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.
looks like tests are failing due to this line: https://github.com/unionai-oss/pandera/actions/runs/5786938731/job/15682750086?pr=1291
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.
Yeah, I should have been more careful regarding pyspark.
Signed-off-by: Nathan McDougall <nmcdougall@tonkintaylor.co.nz>
Signed-off-by: Nathan McDougall <nmcdougall@tonkintaylor.co.nz>
@nathanjmcdougall it seems like merging this PR is breaking linters on |
I can't say precisely why that happened - presumably this branch was a few commits behind |
Amazing, thanks! |
I was having issues with the local hook for
mypy
.Specifically, was getting inconsistent results between running
pre-commit run --all-files
versuspre-commit install
and thengit commit
etc.I changed this configuration to use https://github.com/pre-commit/mirrors-mypy, and once ensuring compliance across the codebase, I could get consistent results. I'm not sure of the motivation for using a local hook - if we need to stick with it, then I think there might need to be some more configuration to get ensure consistency.
For calls to
pd.DataFrame.drop
, I've preferentially used thecolumns
argument since in some cases this was causing mypy issues.Some formatting changes via black.
I also had some trouble considering how to test mypy compliance against different versions of python without creating separate environments for each version and switching between them. I don't know if you have any advice about this for contributors?