From 49878c505ccfd6dceb73c12ead3459c50115a8b7 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Thu, 8 Oct 2020 13:42:38 +0100 Subject: [PATCH 1/5] Let pre-commit sort pxd files too In #1494, it looks like support for `.pxd` files was added. However, these are currently ignored when running isort in pre-commit because there is `types: [python]` --- .pre-commit-hooks.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 0027e49df..25b8325ab 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -3,5 +3,6 @@ entry: isort require_serial: true language: python - types: [python] + files: '.pxd$|.py$' + types: [file] args: ['--filter-files'] From 0179b07d680a624922bf75ee02c03551aab16f05 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Thu, 8 Oct 2020 13:44:43 +0100 Subject: [PATCH 2/5] remove unnecessary types file --- .pre-commit-hooks.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 25b8325ab..ad64de981 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -4,5 +4,4 @@ require_serial: true language: python files: '.pxd$|.py$' - types: [file] args: ['--filter-files'] From b66853ff81b02bada800f9222905e45fa4871b28 Mon Sep 17 00:00:00 2001 From: Timothy Edmund Crosley Date: Fri, 9 Oct 2020 00:12:48 -0700 Subject: [PATCH 3/5] Update .pre-commit-hooks.yaml Use types, not extensions --- .pre-commit-hooks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index ad64de981..6bfb2bba9 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -3,5 +3,5 @@ entry: isort require_serial: true language: python - files: '.pxd$|.py$' + types: [python, cython, pyi] args: ['--filter-files'] From 586cfe1951cd7be8976a8beda0803910ac2cdd3e Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Sun, 11 Oct 2020 15:07:23 +0100 Subject: [PATCH 4/5] update pre-commit example in documentation --- .pre-commit-hooks.yaml | 2 +- docs/upgrade_guides/5.0.0.md | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 6bfb2bba9..0027e49df 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -3,5 +3,5 @@ entry: isort require_serial: true language: python - types: [python, cython, pyi] + types: [python] args: ['--filter-files'] diff --git a/docs/upgrade_guides/5.0.0.md b/docs/upgrade_guides/5.0.0.md index fb767c2c4..6aeb0f65a 100644 --- a/docs/upgrade_guides/5.0.0.md +++ b/docs/upgrade_guides/5.0.0.md @@ -82,9 +82,17 @@ isort now includes an optimized precommit configuration in the repo itself. To u ``` - repo: https://github.com/pycqa/isort - rev: 5.3.2 + rev: 5.6.3 hooks: - id: isort + name: isort (python) + types: [python] + - id: isort + name: isort (cython) + types: [cython] + - id: isort + name: isort (pyi) + types: [pyi] ``` under the `repos` section of your projects `.pre-commit-config.yaml` config. From 1622543078eae774118fa163efb7bab26d3963b8 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Sun, 11 Oct 2020 15:30:26 +0100 Subject: [PATCH 5/5] remove unnecessary types=[python] --- docs/upgrade_guides/5.0.0.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/upgrade_guides/5.0.0.md b/docs/upgrade_guides/5.0.0.md index 6aeb0f65a..c5e806069 100644 --- a/docs/upgrade_guides/5.0.0.md +++ b/docs/upgrade_guides/5.0.0.md @@ -86,7 +86,6 @@ isort now includes an optimized precommit configuration in the repo itself. To u hooks: - id: isort name: isort (python) - types: [python] - id: isort name: isort (cython) types: [cython]