From b5d2c30d26060d4a55c88c1a665b6e9d95ba1644 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sun, 4 Jul 2021 01:51:46 -0700 Subject: style: Move isort configuration to pyproject.toml - [x] Remove flake8-import-order checks, as we only need isort for this - [x] Clean up configuration and requirements --- .flake8 | 4 ---- .github/workflows/unit_tests.yaml | 4 ++-- .isort.cfg | 11 ----------- lib/spack/spack/cmd/style.py | 4 ---- pyproject.toml | 14 ++++++++++++++ 5 files changed, 16 insertions(+), 21 deletions(-) delete mode 100644 .isort.cfg create mode 100644 pyproject.toml diff --git a/.flake8 b/.flake8 index d916433cfe..a4c8aa2fbc 100644 --- a/.flake8 +++ b/.flake8 @@ -66,10 +66,6 @@ exclude = format = spack -# flake8-import-order settings -application-import-names = llnl,spack -import-order-style = pycharm - [flake8:local-plugins] report = spack = flake8_formatter:SpackFormatter diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 434e6d04b4..a4790fc25e 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -39,7 +39,7 @@ jobs: python-version: 3.9 - name: Install Python packages run: | - pip install --upgrade pip six setuptools flake8 flake8-import-order isort mypy>=0.800 black types-six types-python-dateutil + pip install --upgrade pip six setuptools flake8 isort>=4.3.5 mypy>=0.800 black types-six types-python-dateutil - name: Setup git configuration run: | # Need this for the git tests to succeed. @@ -370,7 +370,7 @@ jobs: run: | pip install --upgrade pip six setuptools pip install --upgrade codecov coverage - pip install --upgrade flake8 flake8-import-order isort pep8-naming mypy + pip install --upgrade flake8 isort>=4.3.5 pep8-naming mypy>=0.800 pip install --upgrade python-dateutil - name: Setup Homebrew packages run: | diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index e787561d14..0000000000 --- a/.isort.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[settings] -profile=black -sections=FUTURE,STDLIB,THIRDPARTY,ARCHSPEC,LLNL,FIRSTPARTY,LOCALFOLDER -src_paths=lib -force_sort_within_sections=True -line_length=79 -known_first_party=spack -known_archspec=archspec -known_llnl=llnl -honor_noqa=True -use_parentheses=True diff --git a/lib/spack/spack/cmd/style.py b/lib/spack/spack/cmd/style.py index 1f15db7b8d..23fc3e37ae 100644 --- a/lib/spack/spack/cmd/style.py +++ b/lib/spack/spack/cmd/style.py @@ -219,10 +219,6 @@ def run_flake8(file_list, args): print_tool_header("flake8") flake8_cmd = which("flake8", required=True) - # Check if plugins are installed - if "import-order" not in flake8_cmd("--version", output=str, error=str): - tty.warn("style: flake8-import-order plugin is not installed, skipping") - output = "" # run in chunks of 100 at a time to avoid line length limit # filename parameter in config *does not work* for this reliably diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..fc8dd4e428 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[tool.isort] +profile = "black" +sections = [ + "FUTURE", + "STDLIB", + "THIRDPARTY", + "ARCHSPEC", "LLNL", "FIRSTPARTY", + "LOCALFOLDER", +] +known_first_party = "spack" +known_archspec = "archspec" +known_llnl = "llnl" +src_paths = "lib" +honor_noqa = true -- cgit v1.2.3-60-g2f50