Skip to content

Commit

Permalink
Add precommit section to upgrade guide
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Jul 30, 2020
1 parent 212e160 commit b8c8c00
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/upgrade_guides/5.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Related documentation:
* [isort 5.0.0 changelog](https://timothycrosley.github.io/isort/CHANGELOG/#500-penny-july-4-2020)
* [isort 5 release document](https://timothycrosley.github.io/isort/docs/major_releases/introducing_isort_5/)

!!! important - "If you use pre-commit remove seed-isort-config."
If you currently use pre-commit, make sure to see the pre-commit section of this document. In particular, make sure to remove any `seed-isort-config` pre-step.

## Migrating CLI options

### `--dont-skip` or `-ns`
Expand Down Expand Up @@ -49,3 +52,22 @@ isort has completely rewritten its logic for placing modules in 5.0.0 to ensure
The TL;DR of which is that isort has now changed from `default_section=FIRSTPARTY` to `default_section=THIRDPARTY`. If you all already setting the default section to third party, your config is probably in good shape.
If not, you can either use the old finding approach with `--magic-placement` in the CLI or `old_finders=True` in your config, or preferably, you are able to remove all placement options and isort will determine it correctly.
If it doesn't, you should be able to just specify your projects modules with `known_first_party` and be done with it.

## Migrating pre-commit

### seed-isort-config

If you have a step in your precommit called `seed-isort-config` or similar, it is highly recommend that you remove this. It is unnecessary in 5.x.x, is guaranteed to slow things down, and worse can conflict with isort's own module placement logic.

### isort pre-commit step

isort now includes an optimized precommit configuration in the repo itself. To use it you can replace any existing isort precommit step with:

```
- repo: https://github.com/timothycrosley/isort
rev: master
hooks:
- id: isort
```

under the `repos` section of your projects `.pre-commit-config.yaml` config.

0 comments on commit b8c8c00

Please sign in to comment.