style(api): Automatically sort imports #15171
Closed
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.
Overview
The ordering of
import
statements is a boring style concern, so let's automate it like we automate formatting with Black.Among other things, this is helpful for refactors like #15162, where we want to add a new import to ~60 files.
This goes towards EXEC-456.
To avoid horrific merge conflicts, we should wait to merge this until we merge v7.3.0 back into
edge
.Test plan
None needed.
Changelog
Via isort:
make -C api lint
, check that imports are sorted.make -C api format
, automatically sort imports.Review requests
Review commit-by-commit to separate my manual changes from the automated changes from the initial run of
isort
.If we like this, we can do the same thing in our other Python projects.
Risk assessment
Low.