Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Black Isort incompatibility with comments in import blocks #1260

Closed
r-richmond opened this issue Jul 5, 2020 · 1 comment
Closed

Black Isort incompatibility with comments in import blocks #1260

r-richmond opened this issue Jul 5, 2020 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@r-richmond
Copy link
Contributor

This is an individual case that relates to #694

note: I found this earlier this week before 5.0 release but just confirmed it on 5.0.2 (p.s. congrats on the new release)

Black version: ❯ black --version black, version 19.10b0
Isort Version: ❯ pip list | grep isort
isort 5.0.2
(version displayed this way due to #1255 )

default settings for both tools

Isort's Desired Format

import os
import random

import certifi
# don't import fantasticFlake until they release it
# import fantasticFlake
import flake8
import isort

Black's Desired Format

import os
import random

import certifi

# don't import fantasticFlake until they release it
# import fantasticFlake
import flake8
import isort

Personally I think Isort's format is better/more correct but that decision I leave to the authors of these awesome tools.

@r-richmond
Copy link
Contributor Author

r-richmond commented Jul 5, 2020

Oh it looks like this was brought up in psf/black#251

and the fix is to set ensure_newline_before_comments which makes isort behave like black. Closing this out.

or just use the new feature profiles with the black option https://timothycrosley.github.io/isort/docs/configuration/profiles/

@r-richmond r-richmond changed the title Black Isort incompatibility Black Isort incompatibility with comments in import blocks Jul 5, 2020
@timothycrosley timothycrosley added the documentation Improvements or additions to documentation label Jul 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants