#2649·isort

isort disagrees with black on wrapping over-long star imports

Author: martvaldCreated Sep 3, 2026Updated Sep 3, 2026

Description

Only over-long wildcard imports are affected. Under profile = black (line_length = 88), a from x import * under 88 chars is left alone; once it crosses 88, isort tries to wrap it. Parentheses are not an option, from x import (*) is a SyntaxError, and the dotted module path is the only over-long part, so isort falls back to a backslash continuation.

Black leaves such a line untouched (it also has no way to split it), so isort and black now fight over every long import * in a codebase.

Introduced by 65bfa80 ("Fix word-wrapping of 'from ... import *' into invalid Python (#2267)"), first shipped in 9.0.1. That commit fixed real corruption — thanks — but its message says star imports are "left on a single line", while the code in isort/wrap.py deliberately emits a backslash instead. PR #2559, which proposed returning the statement untouched to match black, was closed unmerged.

Steps to reproduce

ini
# .isort.cfg
[settings]
profile = black
python
# 90 chars - isort rewrites this
from mypkg.vendor.hardware.sdk.bindings.generated.device_parameter_constants_v210 import *

# 88 chars - left alone, as expected
from mypkg.vendor.hardware.sdk.bindings.generated.device_parameter_constants_v2 import *

isort . gives:

python
from mypkg.vendor.hardware.sdk.bindings.generated.device_parameter_constants_v210 import \
    *

black . then rejoins it to one line. Running isort and black in either order does not converge.

Expected

Star imports left on a single line regardless of length under profile = black, matching black.

Notes

No setting avoids it: tested every multi_line_output (0-11), use_parentheses, wrap_length, balanced_wrapping, force_single_line, combine_star, split_on_trailing_comma. Only raising line_length above the line's length works, which then desyncs isort from black on ordinary long imports. multi_line_output = 7 (NOQA) keeps one line but appends # NOQA.

Reproduced on 9.0.1 and on main (Python 3.11).