diff --git a/.githooks/pre-push b/.githooks/pre-push index f73fa492b3..f217da1e42 100755 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -7,7 +7,7 @@ TOX_PARALLEL_NO_SPINNER=1, PY_COLORS=0 start_time=`date +%s` tox -e flake8,pylint,docstyle,black-check,twine --parallel all -./ci-scripts/displaytime.sh 'flake8,pylint,docstyle,black-check,twine' $start_time +./ci-scripts/displaytime.sh 'flake8,pylint,docstyle,black-check,isort-check,twine' $start_time start_time=`date +%s` tox -e sphinx,doc8 --parallel all ./ci-scripts/displaytime.sh 'sphinx,doc8' $start_time diff --git a/requirements/tox/isort_requirements.txt b/requirements/tox/isort_requirements.txt new file mode 100644 index 0000000000..e12edac17e --- /dev/null +++ b/requirements/tox/isort_requirements.txt @@ -0,0 +1 @@ +isort \ No newline at end of file diff --git a/tox.ini b/tox.ini index 566e46a9a7..cdbfe6724c 100644 --- a/tox.ini +++ b/tox.ini @@ -49,6 +49,11 @@ ignore = require-code = True +[isort] +profile = black +src_paths = src,tests +skip_glob = .venv, __pycache__, .tox, build, dist + [doc8] ignore-path=.tox,src/sagemaker.egg-info # TODO: fix files before enabling max-line-length (D001) @@ -111,6 +116,12 @@ commands = flake8 basepython = python3.12 +[testenv:isort-check] +deps = isort +commands = + isort --check-only --diff . + isort . + [testenv:pylint] skipdist = true skip_install = true