Skip to content

Commit e093565

Browse files
committed
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
1 parent c837a14 commit e093565

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

tox.ini

+24-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,8 +141,9 @@ 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]
@@ -146,8 +152,9 @@ skip_install = true
146152
setenv =
147153
LC_ALL=C.UTF-8
148154
LANG=C.UTF-8
155+
deps =
156+
-r requirements/tox/black_requirements.txt
149157
commands =
150-
pip install --exists-action=w -r requirements/tox/black_requirements.txt
151158
black ./
152159

153160
[testenv:black-check]
@@ -156,8 +163,9 @@ skip_install = true
156163
setenv =
157164
LC_ALL=C.UTF-8
158165
LANG=C.UTF-8
166+
deps =
167+
-r requirements/tox/black_requirements.txt
159168
commands =
160-
pip install --exists-action=w -r requirements/tox/black_requirements.txt
161169
black --diff --color --check ./
162170

163171
[testenv:clean]
@@ -166,13 +174,20 @@ commands =
166174
coverage erase
167175

168176
[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
169183
commands =
170-
pip install --exists-action=w -r requirements/tox/mypy_requirements.txt
171184
mypy src/sagemaker
172185

173186
[testenv:docstyle]
187+
skip_install = true
188+
deps =
189+
-r requirements/tox/pydocstyle_requirements.txt
174190
commands =
175-
pip install --exists-action=w -r requirements/tox/pydocstyle_requirements.txt
176191
pydocstyle src/sagemaker
177192

178193
[testenv:collect-tests]

0 commit comments

Comments
 (0)