-
Notifications
You must be signed in to change notification settings - Fork 901
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
Drop Python 3.9 support #16637
Drop Python 3.9 support #16637
Conversation
There are a bunch of new
The cudf/python/cudf_polars/cudf_polars/containers/dataframe.py Lines 137 to 138 in bf2ee32
cudf/python/cudf_polars/cudf_polars/containers/dataframe.py Lines 168 to 169 in bf2ee32
Could use some help from someone more familiar with |
I didn't realize ruff had this rule implemented. That's nice. The comments are related, but are there because I didn't expect a linter to enforce this for us. The |
@@ -115,6 +114,9 @@ ignore = [ | |||
"TD003", # Missing issue link on the line following this TODO | |||
# tryceratops | |||
"TRY003", # Avoid specifying long messages outside the exception class | |||
# pyupgrade | |||
"UP035", # Import from `collections.abc` instead: `Callable` |
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.
Everything else in cudf
uses typing.Callable
.
git grep -E 'import.*Callable'
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.
Confused by this one, is this an auto-upgrade fix that ruff can do for us?
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'm not sure if this is one ruff
will do automatically if asked.
But either way... it recommended this for cudf_polars
but not for the rest of cudf
, because cudf_polars
has its own ruff
config separate from the rest of cudf
.
cudf_polars
uses all the pyupgrade
checks
cudf/python/cudf_polars/pyproject.toml
Line 89 in 8d6b261
"UP", # pyupgrade |
All of the other Python code in the repo only has specific pyupgrade
checks run over it
Lines 87 to 90 in 8d6b261
# non-pep585-annotation | |
"UP006", | |
# non-pep604-annotation | |
"UP007" |
Happy to do whatever you want me to with this particular check, I don't have a strong preference for either pattern so I chose the one that would at least be consistent with the rest of the Python code in this repo.
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.
@wence- could you please let me know what you want to do with this one, and if there's anything else I could help clarify?
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.
typing.Callable
is the deprecated alias, so in cudf-polars can we migrate to using collections.abc.Callable
?
I realise in cudf-classic this is more work, so we can defer doing it there. Thanks!
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 would propose deferring this change to a separate PR unless we can knock it out today. Completing the drop of Python 3.9 is important so we can start adding Python 3.12. We want all these platform changes done before we get too close to burndown.
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.
Ok sure, happy to do that in a follow-up PR after this.
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.
in a follow-up PR after this
Put up #16670 making this change across cudf
.
@@ -115,6 +114,9 @@ ignore = [ | |||
"TD003", # Missing issue link on the line following this TODO | |||
# tryceratops | |||
"TRY003", # Avoid specifying long messages outside the exception class | |||
# pyupgrade | |||
"UP035", # Import from `collections.abc` instead: `Callable` | |||
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)` |
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.
@grlee77 pointed out to me that there's actually a performance penalty associated with using |
instead of a tuple in isinstance()
.
from typing import Callable | ||
|
||
from typing_extensions import TypeAlias | ||
from typing import Callable, TypeAlias |
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.
TypeAlias
moved to typing
in Python 3.10: https://docs.python.org/3/library/typing.html#typing.TypeAlias
There are still other imports from typing_extensions
in cudf-polars
though, so we can't drop the dependency on it.
Alright sounds good, I've done that in recent commits. Just wasn't sure if there were places where we were knowingly relying on the non-strict behavior (i.e. I've addressed everything |
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.
Two missed py39s noted in comments -- otherwise LGTM!
Co-authored-by: Bradley Dice <bdice@bradleydice.com>
I seriously doubt it, and if we are I would want to find out about it! |
question: should we upgrade |
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.
cudf-polars changes all look good, with one tiny question about the typing -> collections.abc
import ignore.
@@ -115,6 +114,9 @@ ignore = [ | |||
"TD003", # Missing issue link on the line following this TODO | |||
# tryceratops | |||
"TRY003", # Avoid specifying long messages outside the exception class | |||
# pyupgrade | |||
"UP035", # Import from `collections.abc` instead: `Callable` |
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.
Confused by this one, is this an auto-upgrade fix that ruff can do for us?
I just tried updating it to the latest version (0.6.2). 41 new non-auto-fixable errors were raised, mainly the those about using I think we should not try to upgrade |
/merge |
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`: ```text Import from `collections.abc` instead: `Callable` ``` * ruff docs: https://docs.astral.sh/ruff/rules/deprecated-import/ * `typing` docs saying that `typing.Callable` is deprecated starting in Python 3.9 https://docs.python.org/3/library/typing.html#typing.Callable * context: #16637 (comment) This proposes accepting that suggestion, so that `cudf` won't be broken whenever `Callable` is removed from the `typing` module. Authors: - James Lamb (https://github.com/jameslamb) Approvers: - Lawrence Mitchell (https://github.com/wence-) - Kyle Edwards (https://github.com/KyleFromNVIDIA) URL: #16670
Description
Contributes to rapidsai/build-planning#88
Finishes the work of dropping Python 3.9 support.
This project stopped building / testing against Python 3.9 as of rapidsai/shared-workflows#235.
This PR updates configuration and docs to reflect that.
Notes for Reviewers
How I tested this
Checked that there were no remaining uses like this:
And similar for variations on Python 3.8 (to catch things that were missed the last time this was done).