Skip to content
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

Run pyupgrade to 3.11 #21903

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

sureshjoshi
Copy link
Member

As we have upgraded the Pants Python to 3.11, makes sense to update pyupgrade to that too.

The upgrade was performed using the following commands (twice each, to make autoflake happy)

pants fix fmt lint src/python::
pants fix fmt lint tests::
pants fix fmt lint pants-plugins::

The overwhelming number of entries are import reorganization from typing to collections.abc, the remainder are capital to lowercase (Dict -> dict, Tuple -> tuple, etc), Optional to pipe, and Union to pipe.

target.py is the worst offender for upgrades, and the only one that gave me pause was in filtering.py - where it no-ops a TYPE_CHECKING import.

I've split the 474 files into 5 commits covering pants-plugins, tests, backends, everything else.

@sureshjoshi sureshjoshi added category:internal CI, fixes for not-yet-released features, etc. release-notes:not-required PR doesn't require mention in release notes labels Feb 3, 2025
@sureshjoshi
Copy link
Member Author

This PR is basically ready (other than the new conflict I have to deal with), however for the sake of explicitness (and safety), I’m not trusting pyupgrade’s Type to type auto-conversion, so I’m going through and manually processing those as type[Any] to avoid breaking more tests (or runtime, more importantly). Should be in later this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc. release-notes:not-required PR doesn't require mention in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant