Page MenuHomePhabricator

lint all the python imports with isort

Authored by PiRK on Sep 15 2021, 16:28.


Group Reviewers
Restricted Project

This is a commit to automatically sort all imports before adding a new linter that will enforce this new sorting.

The command used was (excluding contrib/):

isort --profile=black --line-length=79 .

The rationale for --profile=black is that this generate the same style of multiline imports that we already use: one import per line with trailing commas, use parentheses, ensure newline before comments.

Also, black is increasingly popular and we may want to use it instead of autopep8 some day in the future. So it is a good idea to stay compatible.

The rationale for --line-length=79 is that it is the standard for autopep8, and is more strict (hence compatible with) black which uses 88.

Test Plan
ninja all check-all check-functional-extended
arc lint --everything

Event Timeline

PiRK requested review of this revision.Sep 15 2021, 16:28
Fabien requested changes to this revision.Sep 15 2021, 19:30
Fabien added a subscriber: Fabien.

This is way too big to be reviewed, please split

This revision now requires changes to proceed.Sep 15 2021, 19:30
PiRK planned changes to this revision.Sep 16 2021, 08:53

it needs splitting, and I'm still investigating whether it is possible to preserve the multiline imports that we already have, even if they would be shorter than 80 characters on a single line.

Split into multiple diffs: D10200 - D10206