Update mypy configuration to check against polars#19072
Merged
rapids-bot[bot] merged 3 commits intorapidsai:branch-25.08from Jun 5, 2025
Merged
Update mypy configuration to check against polars#19072rapids-bot[bot] merged 3 commits intorapidsai:branch-25.08from
rapids-bot[bot] merged 3 commits intorapidsai:branch-25.08from
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
This updates our mypy configuration to follow imports for polars. This will help catch issues like https://github.com/rapidsai/cudf/pull/18797/files/981a25b7fa7968395958b9fae32c71bc3f548eda#r2089470041, which slipped through because by not following imports any types from polars are considered Any.
92914db to
109db3f
Compare
TomAugspurger
commented
Jun 3, 2025
mroeschke
approved these changes
Jun 5, 2025
jameslamb
approved these changes
Jun 5, 2025
Member
jameslamb
left a comment
There was a problem hiding this comment.
Nice!
Mostly deferring to @mroeschke 's review here, but the idea seems sound to me and I appreciate the use of specific warning codes in the # type: ignore comments.
Contributor
Author
|
/merge |
3 tasks
rapids-bot Bot
pushed a commit
that referenced
this pull request
Nov 12, 2025
#19072 made a lot of the necessary fixes, but polars was not actually added to the pre-commit mypy environment so we haven't been checking since then. As a result, some new issues have crept in, and #20272 removed various ignores that are required for polars type safety but mypy didn't know that without polars available. Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - GALI PREM SAGAR (https://github.com/galipremsagar) - Bradley Dice (https://github.com/bdice) - Tom Augspurger (https://github.com/TomAugspurger) - Matthew Murray (https://github.com/Matt711) URL: #20563
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates our mypy configuration to be a bit stricter / more thorough in two ways:
polars(i.e. doesn't assign polars typesAny, which always type checks successfully even if incorrect)python/cudf_polars/testsThis will help catch issues like https://github.com/rapidsai/cudf/pull/18797/files/981a25b7fa7968395958b9fae32c71bc3f548eda#r2089470041, which slipped through because by not following imports any types from polars are considered
Anyand so always type check successfully.Note that I haven't disallowed untyped defs in the cudf_polars tests. I can do that if people want to require types in the tests.