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

switch from typing.Callable to collections.abc.Callable #16670

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

jameslamb
Copy link
Member

Description

Follow-up to #16637.

Once this project's minimum support Python version was bumped up to Python 3.10, ruff started raising this error from pyupgrade:

Import from `collections.abc` instead: `Callable`

This proposes accepting that suggestion, so that cudf won't be broken whenever Callable is removed from the typing module.

Checklist

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

Notes for Reviewers

Some of the imports added in this PR are put into if TYPE_CHECKING blocks because of this other error from ruff:

TCH003 Move standard library import `collections.abc.Callable` into a type-checking block

@jameslamb jameslamb added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Aug 27, 2024
@github-actions github-actions bot added Python Affects Python cuDF API. cudf.pandas Issues specific to cudf.pandas cudf.polars Issues specific to cudf.polars labels Aug 27, 2024
@jameslamb jameslamb changed the title WIP: switch from typing.Callable to collections.abc.Callable switch from typing.Callable to collections.abc.Callable Aug 27, 2024
@jameslamb jameslamb marked this pull request as ready for review August 27, 2024 20:59
@jameslamb jameslamb requested review from a team as code owners August 27, 2024 20:59
Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

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

These changes look good to me, thanks James!

I'm happy to have imports in TYPE_CHECKING blocks (even if not avoiding circular imports), FWIW.

@jameslamb
Copy link
Member Author

/merge

@rapids-bot rapids-bot bot merged commit 5491b39 into rapidsai:branch-24.10 Aug 28, 2024
93 checks passed
@jameslamb jameslamb deleted the callable-type branch August 28, 2024 16:03
@jameslamb
Copy link
Member Author

Thanks for the reviews, and for the nudge to change this across cudf @wence-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cudf.pandas Issues specific to cudf.pandas cudf.polars Issues specific to cudf.polars 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.

4 participants