Skip to content

Commit 473d150

Browse files
Merge in lastest from develop for 5.7.0
2 parents 41fa290 + a8f4ff3 commit 473d150

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2750
-1278
lines changed

.deepsource.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ version = 1
33
test_patterns = ["tests/**"]
44
exclude_patterns = [
55
"tests/**",
6+
"scripts/**",
67
"isort/_future/**",
78
"isort/_vendored/**",
89
]

.isort.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
profile=hug
33
src_paths=isort,test
44
skip=tests/unit/example_crlf_file.py
5+

.pre-commit-config.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ repos:
33
rev: 5.5.2
44
hooks:
55
- id: isort
6-
files: 'isort/.*'
7-
- id: isort
8-
files: 'tests/.*'

.pre-commit-hooks.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
entry: isort
44
require_serial: true
55
language: python
6-
types: [python]
6+
language_version: python3
7+
types_or: [cython, pyi, python]
78
args: ['--filter-files']
9+
minimum_pre_commit_version: '2.9.0'

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ Changelog
44
NOTE: isort follows the [semver](https://semver.org/) versioning standard.
55
Find out more about isort's release policy [here](https://pycqa.github.io/isort/docs/major_releases/release_policy/).
66

7+
### 5.7.0 December 30th 2020
8+
- Fixed #1612: In rare circumstances an extra comma is added after import and before comment.
9+
- Fixed #1593: isort encounters bug in Python 3.6.0.
10+
- Implemented #1596: Provide ways for extension formatting and file paths to be specified when using streaming input from CLI.
11+
- Implemented #1583: Ability to output and diff within a single API call to `isort.file`.
12+
- Implemented #1562, #1592 & #1593: Better more useful fatal error messages.
13+
- Implemented #1575: Support for automatically fixing mixed indentation of import sections.
14+
- Implemented #1582: Added a CLI option for skipping symlinks.
15+
- Implemented #1603: Support for disabling float_to_top from the command line.
16+
- Implemented #1604: Allow toggling section comments on and off for indented import sections.
17+
718
### 5.6.4 October 12, 2020
819
- Fixed #1556: Empty line added between imports that should be skipped.
920

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ editors](https://github.com/pycqa/isort/wiki/isort-Plugins) to
2626
quickly sort all your imports. It requires Python 3.6+ to run but
2727
supports formatting Python 2 code too.
2828

29-
[Try isort now from your browser!](https://pycqa.github.io/isort/docs/quick_start/0.-try/)
29+
- [Try isort now from your browser!](https://pycqa.github.io/isort/docs/quick_start/0.-try/)
30+
- [Using black? See the isort and black compatiblity guide.](https://pycqa.github.io/isort/docs/configuration/black_compatibility/)
3031

3132
![Example Usage](https://raw.github.com/pycqa/isort/develop/example.gif)
3233

@@ -348,7 +349,7 @@ of:
348349
FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
349350
```
350351

351-
to your preference:
352+
to your preference (if defined, omitting a default section may cause errors):
352353

353354
```ini
354355
sections=FUTURE,STDLIB,FIRSTPARTY,THIRDPARTY,LOCALFOLDER

art/isort_loves_black.png

60 KB
Loading
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
![isort loves black](https://raw.githubusercontent.com/pycqa/isort/develop/art/isort_loves_black.png)
2+
3+
Compatibility with black
4+
========
5+
6+
Compatibility with black is very important to the isort project and comes baked in starting with version 5.
7+
All that's required to use isort alongside black is to set the isort profile to "black".
8+
9+
## Using a config file (such as .isort.cfg)
10+
11+
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.
12+
This way independent to how users call isort (pre-commit, CLI, or editor integration) the black profile will automatically be applied.
13+
14+
For instance, your _pyproject.toml_ file would look something like
15+
16+
```ini
17+
[tool.isort]
18+
profile = "black"
19+
multi_line_output = 3
20+
```
21+
22+
Read More about supported [config files](https://pycqa.github.io/isort/docs/configuration/config_files/).
23+
24+
## CLI
25+
26+
To use the profile option when calling isort directly from the commandline simply add the --profile black argument: `isort --profile black`.
27+
28+
A demo of how this would look like in your _.travis.yml_
29+
30+
```yaml
31+
language: python
32+
python:
33+
- "3.6"
34+
- "3.7"
35+
- "3.8"
36+
37+
install:
38+
- pip install -r requirements-dev.txt
39+
- pip install isort black
40+
- pip install coveralls
41+
script:
42+
- pytest my-package
43+
- isort --profile black my-package
44+
- black --check --diff my-package
45+
after_success:
46+
- coveralls
47+
48+
```
49+
50+
See [built-in profiles](https://pycqa.github.io/isort/docs/configuration/profiles/) for more profiles.
51+
52+
## Integration with pre-commit
53+
54+
You can also set the profile directly when integrating isort within pre-commit.
55+
56+
```yaml
57+
- repo: https://github.com/pycqa/isort
58+
rev: 5.6.4
59+
hooks:
60+
- id: isort
61+
args: ["--profile", "black", "--filter-files"]
62+
```
63+

docs/configuration/config_files.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ isort supports various standard config formats to allow customizations to be int
55
When applying configurations, isort looks for the closest supported config file, in the order files are listed below.
66
You can manually specify the settings file or path by setting `--settings-path` from the command-line. Otherwise, isort will
77
traverse up to 25 parent directories until it finds a suitable config file.
8+
Note that isort will not leave a git or Mercurial repository (checking for a `.git` or `.hg` directory).
89
As soon as it finds a file, it stops looking. The config file search is done relative to the current directory if `isort .`
910
or a file stream is passed in, or relative to the first path passed in if multiple paths are passed in.
1011
isort **never** merges config files together due to the confusion it can cause.

0 commit comments

Comments
 (0)