<#22878 pants lint :: and pants lint /some/path be...
# github-notifications
q
#22878 pants lint :: and pants lint /some/path behave differently with ruff, but not isort for sorting python deps Issue created by benceferdinandy-signifyd Describe the bug We're trying to switch from using
black
and
isort
to
ruff
. I'm aware of this bug, but I don't think it's this one, because it does not trigger using
isort
only with
ruff
. For context, our monorepo has multiple resolves and several packages in each resolve, which might affect this. My starting state is
isort
configured for sorting python import. Running
pants lint ::
is green, and running
pants lint /path/to/a/specific/file.py
is also green. After removing
isort
from linting and adding
ruff
the behaviour changes: Running
pants lint ::
is showing a bunch of import sorting errors, including in
/path/to/a/specific/file.py
, but running
pants lint /path/to/a/specific/file.py
does NOT so an error. Running ruff directly (
uv run ruff check /path/to/a/specific/file.py
(version 0.11.5)) also shows the error. This is especially problematic, because
pants fix ::
behaves as the individual file linting (so does
pants fix /path/to/a/specific/file.py
), which means it is not possible to achieve a state where
pants lint ::
and
pants fix ::
agree, if I manually format files by running ruff directly
pants fix
will change it back. Note that running ruff directly on the entire repo, or just a single file will always fix the import order to what
pants lint ::
is expecting. Pants version We're using 2.28, but I can reproduce with 2.31.0.dev1 as well. OS MacOS (I have not tested on linux) Additional info Add any other information about the problem here, such as attachments or links to gists, if relevant. pantsbuild/pants