forked from PyCQA/isort
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge in lastest from develop for 5.7.0
- Loading branch information
Showing
48 changed files
with
2,750 additions
and
1,278 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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
profile=hug | ||
src_paths=isort,test | ||
skip=tests/unit/example_crlf_file.py | ||
|
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 |
---|---|---|
|
@@ -3,6 +3,3 @@ repos: | |
rev: 5.5.2 | ||
hooks: | ||
- id: isort | ||
files: 'isort/.*' | ||
- id: isort | ||
files: 'tests/.*' |
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,63 @@ | ||
![isort loves black](https://raw.githubusercontent.com/pycqa/isort/develop/art/isort_loves_black.png) | ||
|
||
Compatibility with black | ||
======== | ||
|
||
Compatibility with black is very important to the isort project and comes baked in starting with version 5. | ||
All that's required to use isort alongside black is to set the isort profile to "black". | ||
|
||
## Using a config file (such as .isort.cfg) | ||
|
||
For projects that officially use both isort and black, we recommend setting the black profile in a config file at the root of your project's repository. | ||
This way independent to how users call isort (pre-commit, CLI, or editor integration) the black profile will automatically be applied. | ||
|
||
For instance, your _pyproject.toml_ file would look something like | ||
|
||
```ini | ||
[tool.isort] | ||
profile = "black" | ||
multi_line_output = 3 | ||
``` | ||
|
||
Read More about supported [config files](https://pycqa.github.io/isort/docs/configuration/config_files/). | ||
|
||
## CLI | ||
|
||
To use the profile option when calling isort directly from the commandline simply add the --profile black argument: `isort --profile black`. | ||
|
||
A demo of how this would look like in your _.travis.yml_ | ||
|
||
```yaml | ||
language: python | ||
python: | ||
- "3.6" | ||
- "3.7" | ||
- "3.8" | ||
|
||
install: | ||
- pip install -r requirements-dev.txt | ||
- pip install isort black | ||
- pip install coveralls | ||
script: | ||
- pytest my-package | ||
- isort --profile black my-package | ||
- black --check --diff my-package | ||
after_success: | ||
- coveralls | ||
|
||
``` | ||
|
||
See [built-in profiles](https://pycqa.github.io/isort/docs/configuration/profiles/) for more profiles. | ||
|
||
## Integration with pre-commit | ||
|
||
You can also set the profile directly when integrating isort within pre-commit. | ||
|
||
```yaml | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.6.4 | ||
hooks: | ||
- id: isort | ||
args: ["--profile", "black", "--filter-files"] | ||
``` | ||
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
Oops, something went wrong.