-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Update pyproject.toml
validation
#4344
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
d2b092d
to
0576d60
Compare
if typing.TYPE_CHECKING: | ||
import sys | ||
|
||
if sys.version_info < (3, 11): | ||
from typing_extensions import Self | ||
else: | ||
from typing import Self |
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.
To be fixed upstream, but this double check is redundant!
if typing.TYPE_CHECKING: | |
import sys | |
if sys.version_info < (3, 11): | |
from typing_extensions import Self | |
else: | |
from typing import Self | |
if typing.TYPE_CHECKING: | |
from typing_extensions import Self |
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 if I introduced this one myself, but I think I get why it is there... Probably the intention is this code to allow automatic update (using either ruff or pyupgrade) once Python 3.11 comes and remove typing_extensions
when viable?
I agree that is not needed, but I would not worry too much about it.
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.
Yeah it's minor. Type-checkers will still understand it and typing_extensions is still not used at runtime.
If it's just an artefact of code generation logic it doesn't hurt, just redundant.
According to review suggestion Co-authored-by: Avasam <samuel.06@hotmail.com>
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.
Thank you very much @Avasam for having a look. Let's see how the CI reacts to the changes, sometimes I have the impression that it is a cat/mouse game with mypy
...
if typing.TYPE_CHECKING: | ||
import sys | ||
|
||
if sys.version_info < (3, 11): | ||
from typing_extensions import Self | ||
else: | ||
from typing import Self |
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 if I introduced this one myself, but I think I get why it is there... Probably the intention is this code to allow automatic update (using either ruff or pyupgrade) once Python 3.11 comes and remove typing_extensions
when viable?
I agree that is not needed, but I would not worry too much about it.
Summary of changes
validate-pyproject
mypy.ini
(¿shouldn't*._validate_pyproject.*
already be excluded?)Closes #4341
Pull Request Checklist
newsfragments/
.(See documentation for details)