Skip to content
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 type hints for Python 3.8 #1795

Merged
merged 5 commits into from
Nov 15, 2022
Merged

Fix type hints for Python 3.8 #1795

merged 5 commits into from
Nov 15, 2022

Conversation

bouweandela
Copy link
Member

@bouweandela bouweandela commented Nov 14, 2022

Description

This fixes the issue with type hints breaking the program in Python 3.8.

It removes the need for allowing implicit optional function arguments.

It also updates the mypy version to a version that supports the --implicit-optional argument. I couldn't find in the changelog when exactly this feature was introduced, so I just pinned it to the latest version or newer. Maybe this is no longer needed, since I removed the implicit_optional command line argument in this pull request? It might be nice to have some lower version though.

Fixes the type hints part of #1793.
Fixes #1789


Before you get started

Checklist

It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.


To help with the number pull requests:

@codecov
Copy link

codecov bot commented Nov 14, 2022

Codecov Report

Merging #1795 (b0a5d63) into main (ef33a2d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1795   +/-   ##
=======================================
  Coverage   91.50%   91.51%           
=======================================
  Files         202      202           
  Lines       10904    10908    +4     
=======================================
+ Hits         9978     9982    +4     
  Misses        926      926           
Impacted Files Coverage Δ
esmvalcore/_task.py 71.62% <100.00%> (+0.06%) ⬆️
esmvalcore/cmor/table.py 94.50% <100.00%> (+0.01%) ⬆️
esmvalcore/config/_config_validators.py 92.75% <100.00%> (+0.05%) ⬆️
esmvalcore/config/_logging.py 97.67% <100.00%> (ø)
esmvalcore/experimental/recipe.py 90.32% <100.00%> (ø)
esmvalcore/experimental/recipe_metadata.py 93.24% <100.00%> (+0.09%) ⬆️
esmvalcore/experimental/recipe_output.py 82.45% <100.00%> (ø)
esmvalcore/experimental/utils.py 56.25% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@bouweandela bouweandela changed the title Fix type hints Fix type hints for Python 3.8 Nov 15, 2022
@bouweandela bouweandela added the bug Something isn't working label Nov 15, 2022
@bouweandela bouweandela marked this pull request as ready for review November 15, 2022 07:53
Copy link

@zklaus zklaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Do we need a strategy or issue or something to remind us to remove the __future__ imports when we arrive in the future, i.e. when we drop 3.8?

@bouweandela
Copy link
Member Author

Thanks for the quick review @zklaus! @ESMValGroup/technical-lead-development-team Would someone have time to merge this?

Do we need a strategy or issue or something to remind us to remove the future imports when we arrive in the future, i.e. when we drop 3.8?

I'm not sure, maybe it will generate more noise than be helpful to create issues for these type of things.

@schlunma schlunma merged commit 4d48ece into main Nov 15, 2022
@schlunma schlunma deleted the fix-type-hints branch November 15, 2022 08:47
@schlunma
Copy link
Contributor

Thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove mypy run implicit option temporarily implemented in PR 1790 after PR 1769 gets merged
3 participants