-
-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1647 from PyCQA/issue/1639
Issue/1639
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Using isort with pre-commit | ||
======== | ||
|
||
isort provides official support for [pre-commit](https://pre-commit.com/). | ||
|
||
### isort pre-commit step | ||
|
||
To use isort's official pre-commit integration add the following config: | ||
|
||
``` | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.6.3 | ||
hooks: | ||
- id: isort | ||
name: isort (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` file. | ||
|
||
### seed-isort-config | ||
|
||
Older versions of isort used a lot of magic to determine import placement, that could easily break when running on CI/CD. | ||
To fix this, a utilitiy called `seed-isort-config` was created. Since isort 5 however, the project has drastically improved its placement | ||
logic and ensured a good level of consistency across environments. | ||
If you have a step in your pre-commit config called `seed-isort-config` or similar, it is highly recommend that you remove this. | ||
It is guaranteed to slow things down, and can conflict with isort's own module placement logic. |