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 profile: enable magic comma #2236

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MrMino
Copy link

@MrMino MrMino commented Feb 16, 2024

When black encounters a trailing comma in the from ... import list, it expands it vertically. Currently, isort --profile=black doesn't do that, which confuses people (including me :)), see #2128.

This PR enables split_on_trailing_comma, which is the default Black's behavior.

I wasn't sure if I should create a new changelog version header, so i omitted it, since that would require deciding whether this is PATCH or MINOR.


What Black does:

$ echo "from x import (a, b, c,)" | black -

from x import (
    a,
    b,
    c,
)
reformatted -

All done! ✨ 🍰 ✨
1 file reformatted.

What isort does currently:

$ echo "from x import (a, b, c,)" | isort --profile=black -

from x import a, b, c

After this change:

$ echo "from x import (a, b, c,)" | isort --profile=black -

from x import (
    a,
    b,
    c,
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant