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
This commit is contained in:
Todd Gamblin 2021-07-04 01:51:46 -07:00
parent 7a9fe189e1
commit b5d2c30d26
5 changed files with 16 additions and 21 deletions

View file

@ -66,10 +66,6 @@ exclude =
format = spack format = spack
# flake8-import-order settings
application-import-names = llnl,spack
import-order-style = pycharm
[flake8:local-plugins] [flake8:local-plugins]
report = report =
spack = flake8_formatter:SpackFormatter spack = flake8_formatter:SpackFormatter

View file

@ -39,7 +39,7 @@ jobs:
python-version: 3.9 python-version: 3.9
- name: Install Python packages - name: Install Python packages
run: | 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 - name: Setup git configuration
run: | run: |
# Need this for the git tests to succeed. # Need this for the git tests to succeed.
@ -370,7 +370,7 @@ jobs:
run: | run: |
pip install --upgrade pip six setuptools pip install --upgrade pip six setuptools
pip install --upgrade codecov coverage 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 pip install --upgrade python-dateutil
- name: Setup Homebrew packages - name: Setup Homebrew packages
run: | run: |

View file

@ -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

View file

@ -219,10 +219,6 @@ def run_flake8(file_list, args):
print_tool_header("flake8") print_tool_header("flake8")
flake8_cmd = which("flake8", required=True) 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 = "" output = ""
# run in chunks of 100 at a time to avoid line length limit # run in chunks of 100 at a time to avoid line length limit
# filename parameter in config *does not work* for this reliably # filename parameter in config *does not work* for this reliably

14
pyproject.toml Normal file
View file

@ -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