-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtox.ini
321 lines (288 loc) · 7.99 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
[tox]
envlist =
lint,
{flake8,pylint},
mypy,
bandit,
doc8, readme, docs,
# prone to false positives
vulture
skipsdist = True
##############################################################################################
# Additional environments: #
# #
# autoformat : Apply all autoformatters. #
# lint :: Run all linters. #
# vulture :: Run vulture. Prone to false-positives. #
# #
# Operational helper environments: #
# #
# docs :: Build Sphinx documentation. #
# autodocs :: Build Sphinx documentation and start server, autobuilding on any file changes. #
# park :: Build name-parking packages using pypi-parker. #
# build :: Build source and wheel dist files. #
# test-release :: Build dist files and upload to testpypi pypirc profile. #
# release :: Build dist files and upload to pypi pypirc profile. #
##############################################################################################
#########
# Tests #
#########
[testenv]
skip_install = True
sitepackages = False
# pipipxx tests cannot run inside virtual environments :(
###############
# Type checks #
###############
[testenv:mypy-coverage]
commands =
# Make mypy linecoverage report readable by coverage
python -c \
"t = open('.coverage', 'w');\
c = open('build/coverage.json').read();\
t.write('!coverage.py: This is a private format, don\'t read it directly!\n');\
t.write(c);\
t.close()"
coverage report -m
[testenv:mypy]
basepython = python3
deps =
# mypy outputs coverage data in a coverage 4.x format
coverage~=4.0
mypy>=0.650
mypy_extensions
typing>=3.6.2
commands =
python -m mypy \
--linecoverage-report build \
setup.py \
{posargs}
{[testenv:mypy-coverage]commands}
###############################
# Formatting and style checks #
###############################
[testenv:flake8]
basepython = python3
deps =
flake8
flake8-docstrings
flake8-isort
flake8-print>=3.1.0
flake8-bugbear
commands =
flake8 \
setup.py \
doc/conf.py
[testenv:pylint]
basepython = python3
deps =
pyflakes
pylint>=2.0.0
commands =
pylint \
--rcfile=pylintrc \
setup.py \
doc/conf.py
[testenv:bandit]
basepython = python3
deps = bandit
commands = bandit \
# B322: Ignore Python 2 input check: we only support Python 3
-s B322 \
-r setup.py
# Prone to false positives: only run manually
[testenv:vulture]
basepython = python3
deps = vulture
commands = vulture setup.py
[testenv:blacken-src]
basepython = python3
deps =
black
commands =
black --line-length 120 \
setup.py \
doc/conf.py \
test \
{posargs}
[testenv:blacken]
basepython = python3
deps =
{[testenv:blacken-src]deps}
commands =
{[testenv:blacken-src]commands}
[testenv:isort-seed]
basepython = python3
deps = seed-isort-config
commands = seed-isort-config
[testenv:isort]
basepython = python3
deps = isort
commands = isort \
-rc \
test \
doc \
setup.py \
{posargs}
[testenv:autoformat]
basepython = python3
deps =
{[testenv:isort-seed]deps}
{[testenv:isort]deps}
{[testenv:blacken]deps}
commands =
{[testenv:isort-seed]commands}
{[testenv:isort]commands}
{[testenv:blacken]commands}
[testenv:doc8]
basepython = python3
whitelist_externals = {[testenv:resetdocs]whitelist_externals}
deps =
sphinx
doc8
commands =
{[testenv:resetdocs]commands}
doc8 doc/index.rst doc/lib/ README.rst CHANGELOG.rst
[testenv:readme]
basepython = python3
deps = readme_renderer
commands = python setup.py check -r -s
[testenv:lint]
basepython = python3
# This lets this testenv execute all commands,
# even if some fail. If *any* fail,
# the command still fails,
# but this lets us get the failing results
# for all commands at once.
ignore_errors=true
whitelist_externals = {[testenv:resetdocs]whitelist_externals}
deps =
{[testenv:autoformat]deps}
{[testenv:flake8]deps}
{[testenv:pylint]deps}
{[testenv:doc8]deps}
{[testenv:readme]deps}
{[testenv:bandit]deps}
commands =
{[testenv:autoformat]commands}
{[testenv:flake8]commands}
{[testenv:pylint]commands}
{[testenv:doc8]commands}
{[testenv:readme]commands}
{[testenv:bandit]commands}
#################
# Documentation #
#################
# Clear out any generated files from doc/
[testenv:resetdocs]
skip_install = true
deps =
whitelist_externals =
mkdir
rm
commands =
# Make sure that the directory exists to avoid
# potential side effects of using rm -f
mkdir -p {toxinidir}/doc/lib/generated
rm -r {toxinidir}/doc/lib/generated
[testenv:assert-file-is-empty]
basepython = python3
commands =
python -c \
"import sys;\
f = open(sys.argv[-1], 'r');\
contents = f.read();\
sys.exit(contents if contents.strip() else 0);\
f.close()" \
{posargs}
[testenv:docs-build]
basepython = python3
deps = {[testenv:docs]deps}
commands =
sphinx-build -E -c {toxinidir}/doc/ -b html {toxinidir}/doc/ {toxinidir}/doc/build/html
{[testenv:assert-file-is-empty]commands} "{toxinidir}/doc/build/html/output.txt"
[testenv:docs-spelling]
basepython = python3
deps = {[testenv:docs]deps}
commands =
sphinx-build -E -c {toxinidir}/doc/ -b spelling {toxinidir}/doc/ {toxinidir}/doc/build/spelling
{[testenv:assert-file-is-empty]commands} "{toxinidir}/doc/build/spelling/output.txt"
[testenv:docs-linkcheck]
basepython = python3
deps = {[testenv:docs]deps}
commands =
sphinx-build -E -c {toxinidir}/doc/ -b linkcheck {toxinidir}/doc/ {toxinidir}/doc/build/linkcheck
{[testenv:assert-file-is-empty]commands} "{toxinidir}/doc/build/linkcheck/output.txt"
[testenv:docs]
basepython = python3
deps =
-r{toxinidir}/doc/requirements.txt
commands =
{[testenv:docs-build]commands}
{[testenv:docs-spelling]commands}
{[testenv:docs-linkcheck]commands}
[testenv:autodocs]
basepython = python3
deps =
{[testenv:docs]deps}
sphinx-autobuild
commands =
sphinx-autobuild -E -c {toxinidir}/doc/ -b html {toxinidir}/doc/ {toxinidir}/doc/build/html \
--watch . \
--ignore .git/*
###################
# Release tooling #
###################
[testenv:park]
basepython = python3
skip_install = true
deps =
pypi-parker
setuptools
commands = python setup.py park
[testenv:build]
basepython = python3
skip_install = true
setenv =
BUILDING_PIPX_IN_PIPX=1
deps =
wheel
setuptools
# This only really works with source builds.
commands =
python setup.py sdist
[testenv:test-release]
basepython = python3
skip_install = true
ignore_errors = false
setenv =
TWINE_REPOSITORY_URL = https://test.pypi.org/legacy/
TWINE_USERNAME = __token__
deps =
{[testenv:park]deps}
{[testenv:build]deps}
twine
whitelist_externals =
rm
commands =
rm -rf {toxinidir}/dist/
{[testenv:park]commands}
{[testenv:build]commands}
twine upload --skip-existing {toxinidir}/dist/*
[testenv:release]
basepython = python3
skip_install = true
ignore_errors = false
setenv =
TWINE_USERNAME = __token__
deps =
{[testenv:park]deps}
{[testenv:build]deps}
twine
whitelist_externals =
rm
commands =
rm -rf {toxinidir}/dist/
{[testenv:park]commands}
{[testenv:build]commands}
twine upload --skip-existing {toxinidir}/dist/*