forked from aws/sagemaker-python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
198 lines (175 loc) · 4.8 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
[tox]
isolated_build = true
envlist = black-format,flake8,pylint,docstyle,sphinx,doc8,twine,py38,py39,py310,py311
skip_missing_interpreters = False
[flake8]
max-line-length = 120
exclude =
build/
.git
__pycache__
examples/
*pb2.py
.tox
tests/data/
venv/
env/
tests/unit/test_tensorboard.py # excluding this file for time being
max-complexity = 10
ignore =
C901,
E203, # whitespace before ':': Black disagrees with and explicitly violates this.
FI10,
FI12,
FI13,
FI14,
FI15,
FI16,
FI17,
FI18, # __future__ import "annotations" missing -> check only Python 3.7 compatible
FI50,
FI51,
FI52,
FI53,
FI54,
FI55,
FI56,
FI57,
FI58,
W503
require-code = True
[doc8]
ignore-path=.tox,src/sagemaker.egg-info
# TODO: fix files before enabling max-line-length (D001)
ignore=D001
[pytest]
markers =
canary_quick
cron
local_mode
slow_test
release
image_uris_unit_test
timeout: mark a test as a timeout.
[testenv]
setenv =
PYTHONHASHSEED=42
pip_version = pip==21.3
passenv =
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
AWS_DEFAULT_REGION
PYTHONHASHSEED
TEST_OWNER
GH_USER_NAME
GH_ACCESS_TOKEN
# {posargs} can be passed in by additional arguments specified when invoking tox.
# Can be used to specify which tests to run, e.g.: tox -- -s
commands =
python -c "import os; os.system('install-custom-pkgs --install-boto-wheels')"
pip install 'apache-airflow==2.9.3' --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.9.3/constraints-3.8.txt"
pip install 'torch==2.0.1+cpu' -f 'https://download.pytorch.org/whl/torch_stable.html'
pip install 'torchvision==0.15.2+cpu' -f 'https://download.pytorch.org/whl/torch_stable.html'
pip install 'dill>=0.3.8'
pytest {posargs}
deps = .[test]
depends =
{py38,py39,py310,p311}: clean
[testenv:runcoverage]
description = run unit tests with coverage
commands =
pytest --cov=sagemaker --cov-append {posargs}
{env:IGNORE_COVERAGE:} coverage report -i --fail-under=86
[testenv:flake8]
skipdist = true
skip_install = true
deps =
-r requirements/tox/flake8_requirements.txt
commands =
flake8
[testenv:pylint]
skipdist = true
skip_install = true
deps =
-r requirements/tox/pylint_requirements.txt
commands =
python -m pylint --rcfile=.pylintrc -j 0 src/sagemaker
[testenv:spelling]
skipdist = true
skip_install = true
deps =
-r requirements/tox/spelling_requirements.txt
commands =
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 =
python -m build --sdist
twine check dist/*.tar.gz
[testenv:sphinx]
pip_version = pip==21.3
changedir = doc
# pip install requirements.txt is separate as RTD does it in separate steps
# having the requirements.txt installed in deps above results in Double Requirement exception
# https://github.com/pypa/pip/issues/988
commands =
pip install --exists-action=w -r requirements.txt
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 =
doc8 --ignore-path tests/data/serve_resources/mlflow/pytorch/data/pickle_module_info.txt
[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
deps =
-r requirements/tox/black_requirements.txt
commands =
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
deps =
-r requirements/tox/black_requirements.txt
commands =
black --diff --color --check ./
[testenv:clean]
skip_install = true
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 =
mypy src/sagemaker
[testenv:docstyle]
skip_install = true
deps =
-r requirements/tox/pydocstyle_requirements.txt
commands =
pydocstyle src/sagemaker
[testenv:collect-tests]
# this needs to succeed for tests to display in some IDEs
deps = .[test]
commands =
pytest --collect-only