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

Update mypy to 1.3 #13340

Merged
merged 4 commits into from
May 12, 2023
Merged

Conversation

wence-
Copy link
Contributor

@wence- wence- commented May 11, 2023

Description

Bring us up to date with the current mypy release. Big diff, mostly due to the no-implicit-optional rule that mypy now enforces (see commit message of 040f577 for details). That commit is automated so probably best to review commit-by-commit for the substantive changes.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

wence- added 4 commits May 11, 2023 18:04
PEP484 prohibits implicit Optional types, so

    def bad(x: int = None):
        pass

Is invalid. MyPy since version 0.983 prohibits this usage by default.
So rewrite all of the typing (except x : Any = None) using
https://github.com/hauntsaninja/no_implicit_optional.
Since the body has type information, the return type needs to be
annotated otherwise mypy produces a warning.
@wence- wence- requested a review from a team as a code owner May 11, 2023 17:57
@wence- wence- requested review from shwina and mroeschke May 11, 2023 17:57
@github-actions github-actions bot added the Python Affects Python cuDF API. label May 11, 2023
@wence- wence- added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels May 11, 2023
@vyasr
Copy link
Contributor

vyasr commented May 11, 2023

This closes issue #13336, right?

@wence-
Copy link
Contributor Author

wence- commented May 11, 2023

This closes issue #13336, right?

Yes, which I had somehow forgotten I had written as I was making this branch

Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

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

One question and one suggestion, but generally LGTM. All the Optional changes seem fine.

python/cudf/cudf/core/column/lists.py Show resolved Hide resolved
python/cudf/cudf/core/column/struct.py Show resolved Hide resolved
@wence-
Copy link
Contributor Author

wence- commented May 12, 2023

/merge

@rapids-bot rapids-bot bot merged commit 6c4ff21 into rapidsai:branch-23.06 May 12, 2023
@wence- wence- deleted the wence/fea/mypy-update branch May 12, 2023 10:54
@bdice
Copy link
Contributor

bdice commented May 12, 2023

@wence- Huge thanks for this. This update will make it easier to keep other pre-commit hooks updated on a semi-regular basis with pre-commit autoupdate. I have wanted to explore doing that update once every release or two but mypy was by far the hardest update to satisfy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEA] Update to mypy >= v1
3 participants