-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
CI: Upgrade 'pyupgrade' (v2.7.4 --> v2.9.0) #39538
CI: Upgrade 'pyupgrade' (v2.7.4 --> v2.9.0) #39538
Conversation
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 @gunjan-solanki for doing this
@simonjayhawkins @Dr-Irv are we OK with making these PEP604 changes? I just saw that an issue was raised here asottile/pyupgrade#387 (comment) , I don't know if that applies to pandas (I haven't yet looked into "runtime introspection of type hints" and don't know if it's a concern which applies)
If we didn't want these rewrites, we could pass --keep-runtime-typing
to pyupgrade
I converted it to draft because of failing typing validation. Few other tests are also failing, possibly because I used |
I'm not 100% sure here, but it seems that we don't want all these typing changes to happen because it would then break doing So using |
I don't think runtime introspection is an issue. I'm generally happy with these changes. This sort of change where changes are made across the codebase can cause autobackports to fail and we don't want to backport style changes. But we will need to take that hit a some point, so no reason imo not to do it sooner rather than later. |
Isn't it supported as long as you have |
There's a number of CI error ATM so these may be unrelated, will come back to this when CI's fixed |
Maybe. I guess we would have to test it in different python versions to be sure. My concern with this typing stuff is that if our library goes out with the latest PEP typing enhancements, and then someone is using python 3.7 and a version of mypy on their application, whether everything will work properly. I think we should stick to "least common denominator" on typing things, but I could be convinced otherwise. |
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.
definitely ok with the idea here. but is this syntax backwards compatible to 1.2.2 if we need to backport things?
e.g. we have a lower mypy version in 1.2.2
That's a good point - maybe this should wait until 1.4.0 then, so that 1.3.x would have a modern enough version of mypy? |
How should I proceed?
Thanks! |
@gunjan-solanki based on the above (which I hadn't considered when I opened the issue, sorry!), I think we can go with the latter, i.e. - repo: https://github.com/asottile/pyupgrade
rev: v2.9.0
hooks:
- id: pyupgrade
args: [--py37-plus, --keep-runtime-typing] This argument can be removed when 1.3.0 is out and autobackports will be a bit easier If you do
and then make the above changes to |
@MarcoGorelli Your guess is spot on. I tested it yesterday and can confirm no reformatting is necessary.
Not an issue. Happy to help. I will go ahead and update the PR :) |
db8a204
to
4a6bee4
Compare
Resolves: GH39523 This commit also adds '--keep-runtime-typing' flag to pyupgrade because of issue with runtime introspection of type hints and backwards compatiblity with v1.2.2. This flag can be removed when v1.3.0 is out and autobackports is a bit easier
4a6bee4
to
fb9920e
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 @gunjan-solanki
This PR upgrades
pyupgrade
and also includes style/formatting changes required after upgradingpyupgrade
, namely, removing unused imports (flake8
), and runningblack
andisort
.