-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[pyupgrade] Stabilize non-pep695-generic-class (UP046)
#18519
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
|
This comment was marked as resolved.
This comment was marked as resolved.
9252447 to
829acf4
Compare
2df4d98 to
8f6a501
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Summary -- The tests were already in the right place, I just updated the documentation slightly to reflect the discussion [here](#18519 (comment)) and on Discord. Documentation: https://docs.astral.sh/ruff/rules/generic-not-last-base-class Tests: https://github.com/astral-sh/ruff/blob/brent/release-0.12.0/crates/ruff_linter/src/rules/flake8_pyi/mod.rs#L51-L52 Test Plan -- Existing tests
8f6a501 to
586b61d
Compare
non-pep695-generic-class (UP046)
aaf6c9b to
96913d1
Compare
3ad0f1f to
ff6fb14
Compare
586b61d to
4e58b8d
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.
Looks good to me. @AlexWaygood do you know if mypy and pyright support this by now or how limited the support still is?
That's my only hesitation for stabilizing this rule.
|
I'm sure they both still have a couple of bugs in edge cases, but my understanding is that they both support PEP 695 pretty well at this point! |
|
Nice, thank you both! Is the support good enough that I should remove these statements from the docs:
Or is that still fair to say? |
|
Hmm, python/mypy#18507 is still unfixed (which we uncovered as a result of the PR initially adding this rule!) Maybe we should link to that directly from the docs? I guess that does feel like something that users could plausibly run into: even if it's not code you'd usually write manually, it's code that could plausibly be generated by this autofix. I don't know if we should hold back from stabilisation just because of the mypy bug, though: that decision doesn't make much sense from the perspective of pyright users. Whatever the case: maybe we should link to that issue directly from the docs |
|
Wow I forgot about that! I confirmed that it's still a problem on mypy 1.16. I'll update the docs here and in #18524. |
|
I'll go ahead and merge these, happy to drop the commits if we decide they should stay in preview. |
non-pep695-generic-class (UP046)pyupgrade] Stabilize non-pep695-generic-class (UP046)
## Summary - Stabilizes UP046 (non-pep695-generic-class) rule by changing it from Preview to Stable ## Test plan - ✅ Rule is already tested in main test function, no migration needed - ✅ `make check` passes - ✅ `make test` passes ## Rule Documentation - [Test file](https://github.com/astral-sh/ruff/blob/main/crates/ruff_linter/src/rules/pyupgrade/mod.rs#L109-L110) - [Rule documentation](https://docs.astral.sh/ruff/rules/non-pep695-generic-class/)
## Summary - Stabilizes UP046 (non-pep695-generic-class) rule by changing it from Preview to Stable ## Test plan - ✅ Rule is already tested in main test function, no migration needed - ✅ `make check` passes - ✅ `make test` passes ## Rule Documentation - [Test file](https://github.com/astral-sh/ruff/blob/main/crates/ruff_linter/src/rules/pyupgrade/mod.rs#L109-L110) - [Rule documentation](https://docs.astral.sh/ruff/rules/non-pep695-generic-class/)
## Summary - Stabilizes UP046 (non-pep695-generic-class) rule by changing it from Preview to Stable ## Test plan - ✅ Rule is already tested in main test function, no migration needed - ✅ `make check` passes - ✅ `make test` passes ## Rule Documentation - [Test file](https://github.com/astral-sh/ruff/blob/main/crates/ruff_linter/src/rules/pyupgrade/mod.rs#L109-L110) - [Rule documentation](https://docs.astral.sh/ruff/rules/non-pep695-generic-class/)
## Summary - Stabilizes UP046 (non-pep695-generic-class) rule by changing it from Preview to Stable ## Test plan - ✅ Rule is already tested in main test function, no migration needed - ✅ `make check` passes - ✅ `make test` passes ## Rule Documentation - [Test file](https://github.com/astral-sh/ruff/blob/main/crates/ruff_linter/src/rules/pyupgrade/mod.rs#L109-L110) - [Rule documentation](https://docs.astral.sh/ruff/rules/non-pep695-generic-class/)
…ence * main: (71 commits) Bump 0.12.0 (astral-sh#18724) Revert "[ty] Offer "Did you mean...?" suggestions for unresolved `from` imports and unresolved attributes (astral-sh#18705)" (astral-sh#18721) [`flake8-return`] Stabilize only add `return None` at the end when fixing `implicit-return` (`RET503`) (astral-sh#18516) [`pyupgrade`] Stabilize `non-pep695-generic-function` (`UP047`) (astral-sh#18524) [`pyupgrade`] Stabilize `non-pep695-generic-class` (`UP046`) (astral-sh#18519) [`pandas-vet`] Deprecate `pandas-df-variable-name` (`PD901`) (astral-sh#18618) [`flake8-bandit`] Remove `suspicious-xmle-tree-usage` (`S320`) (astral-sh#18617) Stabilize `dataclass-enum` (`RUF049`) (astral-sh#18570) Stabilize `unnecessary-dict-index-lookup` (`PLR1733`) (astral-sh#18571) Remove rust-toolchain.toml from sdist (astral-sh#17925) Stabilize `starmap-zip` (`RUF058`) (astral-sh#18525) [`flake8-logging`] Stabilize `exc-info-outside-except-handler` (`LOG014`) (astral-sh#18517) [`pyupgrade`] Stabilize `non-pep604-annotation-optional` (`UP045`) and preview behavior for `non-pep604-annotation-union` (`UP007`) (astral-sh#18505) Stabilize `pytest-warns-too-broad` (`PT030`) (astral-sh#18568) Stabilize `for-loop-writes` (`FURB122`) (astral-sh#18565) Stabilize `pytest-warns-with-multiple-statements` (`PT031`) (astral-sh#18569) Stabilize `pytest-parameter-with-default-argument` (`PT028`) (astral-sh#18566) Stabilize `nan-comparison` (`PLW0177`) (astral-sh#18559) Stabilize `check-and-remove-from-set` (`FURB132`) (astral-sh#18560) Stabilize `unnecessary-round` (`RUF057`) (astral-sh#18563) ...
Summary
Test plan
make checkpassesmake testpassesRule Documentation