Skip to content

Commit a39a188

Browse files
aivanoufacebook-github-bot
authored andcommitted
Torchx: switch from isort to usort (meta-pytorch#31)
Summary: Pull Request resolved: meta-pytorch#31 Switch from isort to usort since usort is used by the insernal fb linter Reviewed By: d4l3k Differential Revision: D28916198 fbshipit-source-id: adc96f20cf85381a5b72a97c98433e3de2896589
1 parent 3662ab7 commit a39a188

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Install Dependencies
2121
run: |
2222
set -eux
23-
pip install isort==4.3.21
23+
pip install usort==0.6.4
2424
pip install black
2525
pip install flake8==3.9.0
2626
- name: Run Lint

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ moto>=2.0.6
33
kfp==1.6.2
44
pyre-extensions>=0.0.21
55
black>=21.5b1
6-
isort==4.3.21
6+
usort==0.6.4
77
pytorch-lightning>=0.5.3
88
torch>=1.8.1
99
torchvision>=0.9.1

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[tool.usort]
2+
first_party_detection = false

scripts/lint.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ then
1212
echo "Please install black."
1313
exit 1
1414
fi
15-
if [ ! "$(isort --version)" ]
15+
if [ ! "$(usort --version)" ]
1616
then
17-
echo "Please install isort."
17+
echo "Please install usort."
1818
exit 1
1919
fi
2020
if [ ! "$(flake8 --version)" ]
@@ -55,8 +55,7 @@ then
5555
for file in $CHANGED_FILES
5656
do
5757
echo "Checking $file"
58-
isort "$file" --recursive --multi-line 3 --trailing-comma --force-grid-wrap 0 \
59-
--line-width 88 --lines-after-imports 2 --combine-as --section-default THIRDPARTY -q
58+
usort format "$file"
6059
black "$file" -q
6160
flake8 "$file" || LINT_ERRORS=1
6261
scripts/copyright.py "$file" || LINT_ERRORS=1
@@ -73,7 +72,7 @@ then
7372
exit 1
7473
fi
7574

76-
# Check if any files were modified by running isort + black
75+
# Check if any files were modified by running usort + black
7776
# If so, then the files were formatted incorrectly (e.g. did not pass lint)
7877
CHANGED_FILES="$(git diff --name-only | grep '\.py$' | tr '\n' ' ')"
7978
if [ "$CHANGED_FILES" != "" ]

0 commit comments

Comments
 (0)