From 36968d4831fd91cfb45702eed80bfacbba65da6c Mon Sep 17 00:00:00 2001 From: Stu Hood Date: Mon, 27 Jul 2020 08:06:57 -0700 Subject: [PATCH] Revert "Use isort v5.x as the default version (#10258)" (#10460) This reverts commit c8274167b73c028600b6156304dc4236f09aa910. 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 https://github.com/timothycrosley/isort/issues/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] --- .isort.cfg | 3 ++- examples/.isort.cfg | 3 ++- src/python/pants/backend/python/lint/isort/subsystem.py | 2 +- src/python/pants/backend/python/rules/coverage.py | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.isort.cfg b/.isort.cfg index f02b0e188e7..b18d7ea47b5 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -9,4 +9,5 @@ force_grid_wrap=0 use_parentheses=True known_first_party=internal_backend,pants,pants_test -default_section=THIRDPARTY \ No newline at end of file +default_section=THIRDPARTY +not_skip=__init__.py diff --git a/examples/.isort.cfg b/examples/.isort.cfg index 4ccda614be0..6e7542be5ac 100644 --- a/examples/.isort.cfg +++ b/examples/.isort.cfg @@ -9,4 +9,5 @@ force_grid_wrap=0 use_parentheses=True known_first_party=example -default_section=THIRDPARTY \ No newline at end of file +default_section=THIRDPARTY +not_skip=__init__.py diff --git a/src/python/pants/backend/python/lint/isort/subsystem.py b/src/python/pants/backend/python/lint/isort/subsystem.py index 0e8a685905e..bc6863a4f16 100644 --- a/src/python/pants/backend/python/lint/isort/subsystem.py +++ b/src/python/pants/backend/python/lint/isort/subsystem.py @@ -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" diff --git a/src/python/pants/backend/python/rules/coverage.py b/src/python/pants/backend/python/rules/coverage.py index 1052e67ffab..84ae4923e7c 100644 --- a/src/python/pants/backend/python/rules/coverage.py +++ b/src/python/pants/backend/python/rules/coverage.py @@ -48,6 +48,7 @@ from pants.option.global_options import GlobMatchErrorBehavior from pants.python.python_setup import PythonSetup + """ An overview: