From a93cb63b9de81b0de4a6cd5f38d5fa9e64699782 Mon Sep 17 00:00:00 2001 From: Justin Mahlik <38999128+jmahlik@users.noreply.github.com> Date: Wed, 17 Apr 2024 15:23:58 -0500 Subject: [PATCH 1/3] change: adjust tox black stages to install from requirements file Also remove uneeded config in the command, it is now set in the pyproject.toml so IDE's and other tooling outside tox picks up the setting. --- pyproject.toml | 2 ++ requirements/tox/black_requirements.txt | 1 + tox.ini | 8 ++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 pyproject.toml create mode 100644 requirements/tox/black_requirements.txt diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..aa4949aa1c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[tool.black] +line-length = 100 diff --git a/requirements/tox/black_requirements.txt b/requirements/tox/black_requirements.txt new file mode 100644 index 0000000000..70f3034c8d --- /dev/null +++ b/requirements/tox/black_requirements.txt @@ -0,0 +1 @@ +black==24.3.0 diff --git a/tox.ini b/tox.ini index f92654842d..8ffb58b2a2 100644 --- a/tox.ini +++ b/tox.ini @@ -142,19 +142,23 @@ commands = [testenv:black-format] # Used during development (before committing) to format .py files. +skip_install = true setenv = LC_ALL=C.UTF-8 LANG=C.UTF-8 commands = - black -l 100 ./ + pip install --exists-action=w -r requirements/tox/black_requirements.txt + black ./ [testenv:black-check] # Used by automated build steps to check that all files are properly formatted. +skip_install = true setenv = LC_ALL=C.UTF-8 LANG=C.UTF-8 commands = - black -l 100 --diff --color --check ./ + pip install --exists-action=w -r requirements/tox/black_requirements.txt + black --diff --color --check ./ [testenv:clean] skip_install = true From 51cc1db45b0fe3afee60c09675d7fd0a1f476cf4 Mon Sep 17 00:00:00 2001 From: Justin Mahlik <38999128+jmahlik@users.noreply.github.com> Date: Wed, 17 Apr 2024 15:41:00 -0500 Subject: [PATCH 2/3] change: improve tox install times by not installing all deps when not needed Moved to using deps to override the test extra being installed in skip_install tox stages. Now only the needed deps are installed. Improves install time by around 7x. Closes #4591 --- tox.ini | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/tox.ini b/tox.ini index 8ffb58b2a2..718e968013 100644 --- a/tox.ini +++ b/tox.ini @@ -100,28 +100,33 @@ commands = [testenv:flake8] skipdist = true skip_install = true +deps = + -r requirements/tox/flake8_requirements.txt commands = - pip install --exists-action=w -r requirements/tox/flake8_requirements.txt flake8 [testenv:pylint] skipdist = true skip_install = true +deps = + -r requirements/tox/pylint_requirements.txt commands = - pip install --exists-action=w -r requirements/tox/pylint_requirements.txt python -m pylint --rcfile=.pylintrc -j 0 src/sagemaker [testenv:spelling] skipdist = true skip_install = true +deps = + -r requirements/tox/spelling_requirements.txt commands = - pip install --exists-action=w -r requirements/tox/spelling_requirements.txt python -m pylint --rcfile=.pylintrc --disable all --enable spelling --spelling-dict en_US src/sagemaker/{posargs} [testenv:twine] # https://packaging.python.org/guides/making-a-pypi-friendly-readme/#validating-restructuredtext-markup +skip_install = true +deps = + -r requirements/tox/twine_requirements.txt commands = - pip install --exists-action=w -r requirements/tox/twine_requirements.txt python setup.py sdist twine check dist/*.tar.gz @@ -136,8 +141,9 @@ commands = sphinx-build -T -W -b html -d _build/doctrees-readthedocs -D language=en . _build/html [testenv:doc8] +deps = + -r requirements/tox/doc8_requirements.txt commands = - pip install --exists-action=w -r requirements/tox/doc8_requirements.txt doc8 --ignore-path tests/data/serve_resources/mlflow/pytorch/data/pickle_module_info.txt [testenv:black-format] @@ -146,8 +152,9 @@ skip_install = true setenv = LC_ALL=C.UTF-8 LANG=C.UTF-8 +deps = + -r requirements/tox/black_requirements.txt commands = - pip install --exists-action=w -r requirements/tox/black_requirements.txt black ./ [testenv:black-check] @@ -156,8 +163,9 @@ skip_install = true setenv = LC_ALL=C.UTF-8 LANG=C.UTF-8 +deps = + -r requirements/tox/black_requirements.txt commands = - pip install --exists-action=w -r requirements/tox/black_requirements.txt black --diff --color --check ./ [testenv:clean] @@ -166,13 +174,20 @@ commands = coverage erase [testenv:typing] +# Do not skip installation here, the extras are needed for mypy to get type info +skip_install = false +extras = + all +deps = + -r requirements/tox/mypy_requirements.txt commands = - pip install --exists-action=w -r requirements/tox/mypy_requirements.txt mypy src/sagemaker [testenv:docstyle] +skip_install = true +deps = + -r requirements/tox/pydocstyle_requirements.txt commands = - pip install --exists-action=w -r requirements/tox/pydocstyle_requirements.txt pydocstyle src/sagemaker [testenv:collect-tests] From 9b5f592a873d4326fa7ff2cf3cb6580921aeb033 Mon Sep 17 00:00:00 2001 From: Justin Mahlik <38999128+jmahlik@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:37:42 -0500 Subject: [PATCH 3/3] change: bump twine version to 5.0.0 Twine 3.8.0 didn't include its dependencies. The tox stage happened to work from packaging being installed as a transitive. Ref: https://github.com/pypa/twine/issues/894 --- requirements/tox/twine_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/tox/twine_requirements.txt b/requirements/tox/twine_requirements.txt index f9d2c8fdce..489eeb83e0 100644 --- a/requirements/tox/twine_requirements.txt +++ b/requirements/tox/twine_requirements.txt @@ -1 +1 @@ -twine==3.8.0 +twine==5.0.0