-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
MNT Update black and ruff config to match min Python version #31016
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
Conversation
97c334f
to
aa4b34d
Compare
Not sure about the mypy error,
|
From the CircleCI log :
I suspect MyPy 1.9 is outdated. |
I get it. Again from the CircleCI log: CircleCI uses Python 3.9:
From the mypy documentation:
So the current mypy target remains 3.9. Bumping CircleCI to 3.10 looks like the proper fix. |
RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs Bumping the Python target version from 3.8 to 3.10 triggered this rule.
2138356
to
3b221a3
Compare
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.
Thanks for the PR!
@@ -228,7 +229,7 @@ def test_incremental_pca_batch_signs(): | |||
ipca = IncrementalPCA(n_components=None, batch_size=batch_size).fit(X) | |||
all_components.append(ipca.components_) | |||
|
|||
for i, j in zip(all_components[:-1], all_components[1:]): | |||
for i, j in itertools.pairwise(all_components): |
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.
Note for other reviewers: this is an automated replacement, ruff
is doing this when using target-version "py310"
@@ -106,7 +106,7 @@ requires = [ | |||
|
|||
[tool.black] | |||
line-length = 88 | |||
target-version = ['py310', 'py311'] | |||
target-version = ['py310', 'py311', 'py312'] |
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.
Not sure it matters that much in practice, but we may as well add py313
right?
target-version = ['py310', 'py311', 'py312'] | |
target-version = ['py310', 'py311', 'py312', 'py313'] |
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.
Unfortunately, py313
is not supported — at least not by the version of black
used here.
Note that #31015, if accepted, will replace black
with ruff format
and remove this line altogether.
Is this PR still needed? It seems like in #31014 similar changes were done. |
I thought this one might be accepted more rapidly, while other PRs would require longer discussions. That's not the case, closing this PR. |
OK thanks for your answer! If you could try to avoid opening multiple PRs that overlap (even only a little bit) that would be more than welcome 🙏! Basically this would avoid having different reviewers duplicate efforts. |
Reference Issues/PRs
Follow-up of #30895.
What does this implement/fix? Explain your changes.
Align
black
andruff
target Python versions with the currently supported Python versions.Any other comments?
These will disappear anyway with #30976 and #31015, but I thought a quick fix would be useful in the meantime.