-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add type hints to feature detection #337
Add type hints to feature detection #337
Conversation
remove python requirement for pip install.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## RC_v1.5.x #337 +/- ##
=============================================
+ Coverage 56.35% 56.43% +0.07%
=============================================
Files 16 16
Lines 3384 3390 +6
=============================================
+ Hits 1907 1913 +6
Misses 1477 1477
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
I decided to reverse course and add |
I'm pro removing python 3.7 support with the v1.6 update, but including |
…ature_detection # Conflicts: # tobac/feature_detection.py
I've switched this to a draft PR until we get 1.5.1 out. |
With 1.5.1 out, I've marked this as ready for review. I think there's an argument to wait on this (and #341) until v1.6.0, but I think there is no harm in doing so with v1.5.2 as well. |
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 good, my only query is regarding the typing of the min_h1
, max_h1
etc... variables for PBCs
Looks very good - also nice that you addressed some pylint issues in the same go! |
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.
I really like this addition! It all looks good and a great starting point for adding type hints to the rest of tobac (if that's still the plan).
…_detection # Conflicts: # tobac/feature_detection.py
Updated now that we have merged in #293 |
@JuliaKukulies did I get the type for the statistics right? If so, I will go ahead and merge. |
Yes, looks good! |
Partially resolves #75 for feature detection only and adds type hints to all function calls. At the same time, I also went through and dealt with some of the easier issues that pylint found.
I started this process in an effort to start to think through our xarray transition. It helped me think through where iris is actually used (which isn't often in feature detection).
Note that to get
Literal
to work, we will have to increase our Python requirement to 3.8. I think this is reasonable given that 3.7 is EOL and is no longer available to be installed throughconda
. 3.7 first came out in 2018, but its most recent release was this June. There are two alternatives if we don't want to do this: 1. require thetyping_extensions
package. This is a new requirement, and all new requirements should be scrutinized, but given that it is frompython
itself, I think there is a low risk for inclusion. 2. make the types for our options juststr
, which I think is less preferred.In the absence of automated matrix testing, I've run tests on my local machine with Python 3.11 and 3.8, both of which pass. There are still a number of linting errors, but c'est la vie.