-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[F821] Improve error message for anext
/aiter
#13287
Comments
False positive on |
Have you specified |
Good catch. I have a monorepo and the root project has [project]
# ...
requires-python = "~=3.12.0"
[tool.ruff]
target-version = "py312" and one of the sub-packages has [project]
# ...
requires-python = "~=3.12.0"
[tool.ruff]
target-version = "py38" I can confirm that changing from In cases like there where there is a new symbol introduced in a more recent version of Python, should ruff instead suggest/direct the end-user to update the settings? |
That's a neat idea. I think the error message could possibly be improved by saying that the symbol is only defined in Python XX or newer. |
anext
anext
/aiter
I have updated the original issue to incorporate the suggestion that Ruff provide a better suggestion in this case. |
Workaround for astral-sh/ruff#13287
Thanks @AlexWaygood ! |
Summary
The lint F821 has a false positive with
anext
.As pointed out by @MichaReiser, this ultimately is due to having either
project.requires-python
ortools.ruff.target-version
set to a too lower version.In this instances, it was discovered that Ruff was targeting Python 3.8 (from an erroneous config).
Example
Desired Behaviour
Where a symbol is introduced in a more recent version of Python, Ruff should:
reures-python
ortarget-version
.Environment
The text was updated successfully, but these errors were encountered: