From 48c545bbee4348f14c2d235a2c6a1442eb63454e Mon Sep 17 00:00:00 2001 From: Paul Marillonnet Date: Fri, 21 Jan 2022 13:09:38 +0100 Subject: [PATCH] misc: add isort/pyupgrade notes (#60931) --- .git-blame-ignore-revs | 2 ++ .pre-commit-config.yaml | 10 ++++++++++ README | 13 +++++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 9678ac8..294a484 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,2 +1,4 @@ # trivial: apply black 7a234d5fe7ae6bee3ba1d0f688967e8e6cf209e3 +# trivial: apply isort & pyupgrade +1abbbadd9469a3f2ff7eafb0ec6956c2b1c6763c diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 01dbc86..225214f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,3 +6,13 @@ 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: + - id: pyupgrade + args: ['--keep-percent-format', '--py37-plus'] diff --git a/README b/README index 30cea87..c8d5177 100644 --- a/README +++ b/README @@ -28,8 +28,17 @@ black is used to format the code, using thoses parameters: black --target-version py37 --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 parameter: + + 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 run black, +isort and pyupgrade before commits. (execute `pre-commit install` to install +the git hook.) License