Skip to content

Commit

Permalink
Revert "Use isort v5.x as the default version (#10258)" (#10460)
Browse files Browse the repository at this point in the history
This reverts commit c827416.

Between isort 4 and isort 5, the requirement on which files are present in the sandbox has changed, and this can result in unstable sort orders. See PyCQA/isort#1147 for the likely cause. Under isort 5, the following set of roots (via `./pants --changed-parent=master list` can result in an order that does not align with `./pants list ::`: https://gist.github.com/stuhood/ec04e86b8a1f44d8b11dcb79a1732a8f

In order to use isort 5 stably in a sandbox, we will need to include the necessary transitive dependencies for it to execute its new first-party-detection algorithm, or disable it.

[ci skip-rust-tests]
  • Loading branch information
stuhood authored Jul 27, 2020
1 parent 03c1857 commit 36968d4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ force_grid_wrap=0
use_parentheses=True

known_first_party=internal_backend,pants,pants_test
default_section=THIRDPARTY
default_section=THIRDPARTY
not_skip=__init__.py
3 changes: 2 additions & 1 deletion examples/.isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ force_grid_wrap=0
use_parentheses=True

known_first_party=example
default_section=THIRDPARTY
default_section=THIRDPARTY
not_skip=__init__.py
2 changes: 1 addition & 1 deletion src/python/pants/backend/python/lint/isort/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Isort(PythonToolBase):
"""The Python import sorter tool (https://timothycrosley.github.io/isort/)."""

options_scope = "isort"
default_version = "isort>=5.0.0,<6.0"
default_version = "isort>=4.3.21,<4.4"
default_extra_requirements = ["setuptools<45"] # NB: `<45` is for Python 2 support
default_entry_point = "isort.main"

Expand Down
1 change: 1 addition & 0 deletions src/python/pants/backend/python/rules/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
from pants.option.global_options import GlobMatchErrorBehavior
from pants.python.python_setup import PythonSetup


"""
An overview:
Expand Down

0 comments on commit 36968d4

Please sign in to comment.