For .py files, the maximum empty lines for black are 2 and everything works fine. However, for .pyi stubs files, black only allows a single blank line at the top level, while isort adds an extra blank line when setting lines_after_imports = 2.
For .pyi files, if the user runs black first and then isort, there will be 2 empty lines after imports. If the user runs isort before black, there will be only 1 empty line after imports. Both black and isort will modify the .pyi files. And command:
isort --check *.pyi && black --check *.pyi
always fails if set lines_after_imports = 2.
The user have to add isort: off at the top of all .pyi files.
The text was updated successfully, but these errors were encountered:
isort
andblack
are two famous quality control tools. And usually, they are used together. Black CompatibilityThe user may set custom
lines_after_imports
in their configuration file (e.g.pyproject.toml
):For
.py
files, the maximum empty lines forblack
are 2 and everything works fine. However, for.pyi
stubs files,black
only allows a single blank line at the top level, whileisort
adds an extra blank line when settinglines_after_imports = 2
.https://github.com/psf/black/blob/b60b85b234d6a575f636d0a125478115f993c90c/src/black/lines.py#L485-L487
For
.pyi
files, if the user runsblack
first and thenisort
, there will be 2 empty lines after imports. If the user runsisort
beforeblack
, there will be only 1 empty line after imports. Bothblack
andisort
will modify the.pyi
files. And command:always fails if set
lines_after_imports = 2
.The user have to add
isort: off
at the top of all.pyi
files.The text was updated successfully, but these errors were encountered: