Skip to content

Commit

Permalink
Merge in lastest from develop for 5.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Dec 31, 2020
2 parents 41fa290 + a8f4ff3 commit 473d150
Show file tree
Hide file tree
Showing 48 changed files with 2,750 additions and 1,278 deletions.
1 change: 1 addition & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version = 1
test_patterns = ["tests/**"]
exclude_patterns = [
"tests/**",
"scripts/**",
"isort/_future/**",
"isort/_vendored/**",
]
Expand Down
1 change: 1 addition & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
profile=hug
src_paths=isort,test
skip=tests/unit/example_crlf_file.py

3 changes: 0 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ repos:
rev: 5.5.2
hooks:
- id: isort
files: 'isort/.*'
- id: isort
files: 'tests/.*'
4 changes: 3 additions & 1 deletion .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
entry: isort
require_serial: true
language: python
types: [python]
language_version: python3
types_or: [cython, pyi, python]
args: ['--filter-files']
minimum_pre_commit_version: '2.9.0'
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ Changelog
NOTE: isort follows the [semver](https://semver.org/) versioning standard.
Find out more about isort's release policy [here](https://pycqa.github.io/isort/docs/major_releases/release_policy/).

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

### 5.6.4 October 12, 2020
- Fixed #1556: Empty line added between imports that should be skipped.

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ editors](https://github.com/pycqa/isort/wiki/isort-Plugins) to
quickly sort all your imports. It requires Python 3.6+ to run but
supports formatting Python 2 code too.

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

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

Expand Down Expand Up @@ -348,7 +349,7 @@ of:
FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
```

to your preference:
to your preference (if defined, omitting a default section may cause errors):

```ini
sections=FUTURE,STDLIB,FIRSTPARTY,THIRDPARTY,LOCALFOLDER
Expand Down
Binary file added art/isort_loves_black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions docs/configuration/black_compatibility.md
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"]
```

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

0 comments on commit 473d150

Please sign in to comment.