Fix Python format CI failures due to black && pyright package updates #14521
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix failures due to black && pyright package updates
Problem
In the passing 3 hours, all PRs have their Python lint CI failed. Many files are reported not well formatted. I believe this is due to updated black package did some changes. Also there is a pyright checking failure, after investigation it is due to pyright package upgrade.
Failure 1: "Lint Python" failure related to pyright:
Failure 2: "Python format" failure related to "psf/black@stable":
Many files are reported not well formatted, an example:
Root causes
Failure 1.
pyright
publish new release 1.1.292 about 4 hourse ago.. https://www.npmjs.com/package/pyright?activeTab=versions. If we revert the version back to previous release 1.1.291, then this test pass.Failure 2.
black
ublish its release few hours ago. https://pypi.org/project/black/#historyFixes
Failure 1. Fixed the
pyright
to use previous release 1.1.291.Failure 2. This PR firstly attempted to update all impacted files based on new version of black package offline. But we hit a throttling issue when calling format services :
So an alternative fix is done here, e.g. fix the version of the black package to previous release 22.12.0.
Would like to get some feedback from @justinchuby, feel free to make some change based on this to unblock other PRs.
Motivation and Context