From 3afaa1148a1b087ba8fcde5d1a0b15e27cdd46bd Mon Sep 17 00:00:00 2001 From: Serghei Mihai Date: Wed, 24 Nov 2021 13:14:46 +0100 Subject: [PATCH] misc: add isort (#58937) --- .git-blame-ignore-revs | 2 ++ .pre-commit-config.yaml | 5 +++++ README.txt | 12 ++++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index fe9f517..e6b1e07 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -2,3 +2,5 @@ caa40e7e771b41bd1d164341a2e7f40689cbe4ba # trivial: apply black (#58937) 3ee72e5336d03526c7ab297a5cf09057a6d5d1c2 +# trivial: apply isort (#58937) +8bf4ab81c5483af946365645d15708796c832d7e diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 354b2d8..ce247d6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,6 +6,11 @@ repos: hooks: - id: black args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110'] +- repo: https://github.com/PyCQA/isort + rev: 5.7.0 + hooks: + - id: isort + args: ['--profile', 'black', '--line-length', '110'] - repo: https://github.com/asottile/pyupgrade rev: v2.20.0 hooks: diff --git a/README.txt b/README.txt index 67c9e9a..159d8b1 100644 --- a/README.txt +++ b/README.txt @@ -187,13 +187,17 @@ black is used to format the code, using thoses parameters: black --target-version py35 --skip-string-normalization --line-length 110 -There is .pre-commit-config.yaml to use pre-commit to automatically run black -before commits. (execute `pre-commit install` to install the git hook.) +isort is used to format the imports, using those parameters: + isort --profile black --line-length 110 pyupgrade is used to automatically upgrade syntax, using those parameters: pyupgrade --keep-percent-format --py37-plus -There is .pre-commit-config.yaml to use pre-commit to automatically pyupgrade -before commits. (execute `pre-commit install` to install the git hook.) +There is .pre-commit-config.yaml to use pre-commit to automatically run black, +isort and pyupgrade before commits. (execute `pre-commit install` to install +the git hook.) + + +