Skip to content

Commit e5878c7

Browse files
jmahlikjiapinw
authored andcommitted
Fix tox installs (aws#4603)
* 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. * 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 aws#4591 * 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: pypa/twine#894
1 parent 021c015 commit e5878c7

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

pyproject.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[tool.black]
2+
line-length = 100
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
black==24.3.0
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
twine==3.8.0
1+
twine==5.0.0

tox.ini

+28-9
Original file line numberDiff line numberDiff line change
@@ -100,28 +100,33 @@ commands =
100100
[testenv:flake8]
101101
skipdist = true
102102
skip_install = true
103+
deps =
104+
-r requirements/tox/flake8_requirements.txt
103105
commands =
104-
pip install --exists-action=w -r requirements/tox/flake8_requirements.txt
105106
flake8
106107

107108
[testenv:pylint]
108109
skipdist = true
109110
skip_install = true
111+
deps =
112+
-r requirements/tox/pylint_requirements.txt
110113
commands =
111-
pip install --exists-action=w -r requirements/tox/pylint_requirements.txt
112114
python -m pylint --rcfile=.pylintrc -j 0 src/sagemaker
113115

114116
[testenv:spelling]
115117
skipdist = true
116118
skip_install = true
119+
deps =
120+
-r requirements/tox/spelling_requirements.txt
117121
commands =
118-
pip install --exists-action=w -r requirements/tox/spelling_requirements.txt
119122
python -m pylint --rcfile=.pylintrc --disable all --enable spelling --spelling-dict en_US src/sagemaker/{posargs}
120123

121124
[testenv:twine]
122125
# https://packaging.python.org/guides/making-a-pypi-friendly-readme/#validating-restructuredtext-markup
126+
skip_install = true
127+
deps =
128+
-r requirements/tox/twine_requirements.txt
123129
commands =
124-
pip install --exists-action=w -r requirements/tox/twine_requirements.txt
125130
python setup.py sdist
126131
twine check dist/*.tar.gz
127132

@@ -136,39 +141,53 @@ commands =
136141
sphinx-build -T -W -b html -d _build/doctrees-readthedocs -D language=en . _build/html
137142

138143
[testenv:doc8]
144+
deps =
145+
-r requirements/tox/doc8_requirements.txt
139146
commands =
140-
pip install --exists-action=w -r requirements/tox/doc8_requirements.txt
141147
doc8 --ignore-path tests/data/serve_resources/mlflow/pytorch/data/pickle_module_info.txt
142148

143149
[testenv:black-format]
144150
# Used during development (before committing) to format .py files.
151+
skip_install = true
145152
setenv =
146153
LC_ALL=C.UTF-8
147154
LANG=C.UTF-8
155+
deps =
156+
-r requirements/tox/black_requirements.txt
148157
commands =
149-
black -l 100 ./
158+
black ./
150159

151160
[testenv:black-check]
152161
# Used by automated build steps to check that all files are properly formatted.
162+
skip_install = true
153163
setenv =
154164
LC_ALL=C.UTF-8
155165
LANG=C.UTF-8
166+
deps =
167+
-r requirements/tox/black_requirements.txt
156168
commands =
157-
black -l 100 --diff --color --check ./
169+
black --diff --color --check ./
158170

159171
[testenv:clean]
160172
skip_install = true
161173
commands =
162174
coverage erase
163175

164176
[testenv:typing]
177+
# Do not skip installation here, the extras are needed for mypy to get type info
178+
skip_install = false
179+
extras =
180+
all
181+
deps =
182+
-r requirements/tox/mypy_requirements.txt
165183
commands =
166-
pip install --exists-action=w -r requirements/tox/mypy_requirements.txt
167184
mypy src/sagemaker
168185

169186
[testenv:docstyle]
187+
skip_install = true
188+
deps =
189+
-r requirements/tox/pydocstyle_requirements.txt
170190
commands =
171-
pip install --exists-action=w -r requirements/tox/pydocstyle_requirements.txt
172191
pydocstyle src/sagemaker
173192

174193
[testenv:collect-tests]

0 commit comments

Comments
 (0)