-
Notifications
You must be signed in to change notification settings - Fork 43
/
tox.ini
509 lines (466 loc) · 14.9 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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
[tox]
envlist =
test-py{38,39,310,311,312,313}
docs
lint
lintclient
type
notebook
skip_missing_interpreters = true
toxworkdir = {toxinidir}/build/tox
[testenv]
passenv = PYTEST_*,COVERAGE_*,DICOMWEB_TEST_*,REDIS_TEST_*,GIRDER_BUILD_OPTIONS,PIP_*,CFLAGS
extras =
memcached
redis
performance
setenv =
PIP_FIND_LINKS=https://girder.github.io/large_image_wheels
GDAL_PAM_ENABLED=no
GDAL_HTTP_MAX_RETRY=5
GDAL_HTTP_RETRY_DELAY=5
[testenv:test]
description = Run all tests, including Girder
deps =
-rrequirements-test.txt
coverage
mock
pooch
pytest
pytest-cov
pytest-custom-exit-code
pytest-girder
pytest-rerunfailures
pytest-xdist
allowlist_externals =
rm
npx
# Run most tests in parallel and conflicting tests sequentially
commands =
rm -rf build/test/coverage/web_temp
girder build --dev {env:GIRDER_BUILD_OPTIONS}
pytest --numprocesses 0 -m 'singular' --cov-config tox.ini --suppress-no-test-exit-code {posargs}
pytest --numprocesses {env:PYTEST_NUMPROCESSES:logical} -m 'not singular and not notebook' --cov-config tox.ini --cov-append --suppress-no-test-exit-code {posargs}
- npx nyc report --temp-dir build/test/coverage/web_temp --report-dir build/test/coverage --reporter cobertura --reporter text-summary
# Reduce npm chatter
setenv =
NPM_CONFIG_FUND=false
NPM_CONFIG_AUDIT=false
NPM_CONFIG_AUDIT_LEVEL=high
NPM_CONFIG_LOGLEVEL=warn
NPM_CONFIG_PROGRESS=false
NPM_CONFIG_PREFER_OFFLINE=true
PIP_FIND_LINKS=https://girder.github.io/large_image_wheels
PIP_PREFER_BINARY=1
GDAL_PAM_ENABLED=no
GDAL_HTTP_MAX_RETRY=5
GDAL_HTTP_RETRY_DELAY=5
# Versions that do have all tile sources. Using the requirements-dev.txt file
# installs in editable mode, which then includes results in coverage.
[testenv:test-py{38,39,310,311,312,313}]
# Don't package for tests where we use editable modes
package=editable
passenv = {[testenv:test]passenv}
extras = {[testenv:test]extras}
deps =
-rrequirements-dev.txt
coverage
mock
pooch
pytest
pytest-cov
pytest-custom-exit-code
pytest-girder
pytest-rerunfailures
pytest-xdist
allowlist_externals = {[testenv:test]allowlist_externals}
commands = {[testenv:test]commands}
setenv = {[testenv:test]setenv}
[testenv:monkeytype-py{38,39,310,311,312,313}]
passenv = {[testenv:test]passenv}
deps =
-rrequirements-dev.txt
coverage
mock
pooch
pytest
pytest-cov
pytest-custom-exit-code
pytest-girder
pytest-monkeytype
pytest-rerunfailures
pytest-xdist
allowlist_externals = {[testenv:test]allowlist_externals}
commands =
rm -rf build/test/coverage/web_temp
-rm ./monkeytype.sqlite3
girder build --dev
pytest --numprocesses 0 -m 'not notebook' --no-cov --suppress-no-test-exit-code --monkeytype-output=./monkeytype.sqlite3 {posargs}
- npx nyc report --temp-dir build/test/coverage/web_temp --report-dir build/test/coverage --reporter cobertura --reporter text-summary
# After running tox, you can do
# build/tox/monkeytype-py311/bin/monkeytype list-modules
# and apply the results via
# build/tox/monkeytype-py311/bin/monkeytype apply <module>
setenv =
NPM_CONFIG_FUND=false
NPM_CONFIG_AUDIT=false
NPM_CONFIG_AUDIT_LEVEL=high
NPM_CONFIG_LOGLEVEL=warn
NPM_CONFIG_PROGRESS=false
NPM_CONFIG_PREFER_OFFLINE=true
PIP_FIND_LINKS=https://girder.github.io/large_image_wheels
PIP_PREFER_BINARY=1
GDAL_PAM_ENABLED=no
GDAL_HTTP_MAX_RETRY=5
GDAL_HTTP_RETRY_DELAY=5
[testenv:server]
description = Run all tests except Girder client
deps = {[testenv:test]deps}
commands =
pytest --numprocesses 0 -m 'singular and not girder_client' --cov-config tox.ini --suppress-no-test-exit-code {posargs}
pytest --numprocesses {env:PYTEST_NUMPROCESSES:logical} -m 'not singular and not girder_client' --cov-config tox.ini --cov-append --suppress-no-test-exit-code {posargs}
[testenv:server-py{38,39,310,311,312,313}]
deps = {[testenv:server]deps}
commands = {[testenv:server]commands}
# For running just one test, it is often clearer to do
# tox -e <env> -- --numprocesses 0 --no-cov -k <test name>
# Further, for full tests, you can skip doing an actual build by passing the
# GIRDER_BUILD_OPTIONS environment variable, such as
# GIRDER_BUILD_OPTIONS=--help tox -e <env> -- --numprocesses 0 --no-cov -k <test name>
# Another way to accomplish this is to just run pytest in the tox environment
# GDAL_PAM_ENABLED=no build/tox/test-py311/bin/pytest --no-cov -k <test name>
[testenv:core]
description = Run core tests. This is all but Girder
deps =
-rrequirements-test-core.txt
coverage
mock
pooch
pytest
pytest-cov
pytest-custom-exit-code
pytest-rerunfailures
pytest-xdist
commands =
pytest --numprocesses 0 -m 'singular and not girder' --cov-config tox.ini --suppress-no-test-exit-code {posargs}
pytest --numprocesses {env:PYTEST_NUMPROCESSES:logical} -m 'not singular and not girder and not notebook' --cov-config tox.ini --cov-append --suppress-no-test-exit-code {posargs}
[testenv:core-py{38,39,310,311,312,313}]
deps = {[testenv:core]deps}
commands = {[testenv:core]commands}
[testenv:notebook]
description = Run tests on notebooks
deps =
ipykernel
nbconvert
nbformat
pooch
pytest
pytest-cov
pytest-custom-exit-code
pytest-rerunfailures
pytest-xdist
commands =
pytest --numprocesses 0 -m 'notebook' --no-cov --suppress-no-test-exit-code test/test_notebooks.py {posargs}
setenv =
PIP_FIND_LINKS=https://girder.github.io/large_image_wheels
PIP_PREFER_BINARY=1
GDAL_PAM_ENABLED=no
GDAL_HTTP_MAX_RETRY=5
GDAL_HTTP_RETRY_DELAY=5
JUPYTER_PLATFORM_DIRS=1
[testenv:lint]
description = Lint python code
skipsdist = true
skip_install = true
deps =
flake8
flake8-bugbear
flake8-docstrings
flake8-isort
flake8-quotes
ruff
yamlfix
allowlist_externals =
find
commands =
ruff check large_image sources utilities girder girder_annotation examples docs test
flake8
find . \( -name '*.yaml' -o -name '*.yml' \) -not -path './build/*' -not -path '*/node_modules/*' -exec yamlfix -c pyproject.toml --check {} \+
[testenv:type]
description = Check python types
skipsdist = true
deps =
-rrequirements-dev.txt
mypy
types-cachetools
types-pillow
types-psutil
commands =
mypy --config-file tox.ini {posargs}
[testenv:type-py{38,39,310,311,312,313}]
description = {[testenv:type]description}
skipsdist = true
deps = {[testenv:type]deps}
commands = {[testenv:type]commands}
[testenv:flake8]
description = Lint python code
skipsdist = true
skip_install = true
deps =
flake8
flake8-bugbear
flake8-docstrings
flake8-isort
flake8-quotes
commands =
flake8 {posargs}
[testenv:ruff]
description = Lint python code
skipsdist = true
skip_install = true
deps =
ruff
commands =
ruff check large_image sources utilities girder girder_annotation examples docs test {posargs}
[testenv:format]
description = Autoformat import order and autopep8
skipsdist = true
skip_install = true
base_python=python3.9
deps =
autopep8
isort
unify
ruff
yamlfix
allowlist_externals =
find
commands =
isort .
autopep8 -ria large_image sources utilities girder girder_annotation examples docs test
unify --in-place --recursive large_image sources utilities girder girder_annotation examples docs test
ruff check large_image sources utilities girder girder_annotation examples docs test --fix
find . \( -name '*.yaml' -o -name '*.yml' \) -not -path './build/*' -not -path '*/node_modules/*' -exec yamlfix -c pyproject.toml {} \+
[testenv:lintclient]
description = Lint the girder large_image plugin client
skip_install = true
deps =
allowlist_externals =
npm
commands =
npm --prefix {toxinidir}/girder/girder_large_image/web_client install --no-package-lock
npm --prefix {toxinidir}/girder_annotation/girder_large_image_annotation/web_client install --no-package-lock
npm --prefix {toxinidir}/sources/dicom/large_image_source_dicom/web_client install --no-package-lock
npm --prefix {toxinidir}/girder/girder_large_image/web_client run lint
npm --prefix {toxinidir}/girder_annotation/girder_large_image_annotation/web_client run lint
npm --prefix {toxinidir}/sources/dicom/large_image_source_dicom/web_client run lint
[testenv:formatclient]
description = Autoformat client
skip_install = true
deps =
allowlist_externals =
npm
commands =
npm --prefix {toxinidir}/girder/girder_large_image/web_client install --no-package-lock
npm --prefix {toxinidir}/girder_annotation/girder_large_image_annotation/web_client install --no-package-lock
npm --prefix {toxinidir}/sources/dicom/large_image_source_dicom/web_client install --no-package-lock
npm --prefix {toxinidir}/girder/girder_large_image/web_client run format
npm --prefix {toxinidir}/girder_annotation/girder_large_image_annotation/web_client run format
npm --prefix {toxinidir}/sources/dicom/large_image_source_dicom/web_client run format
# You can use "tox devenv -e dev <venv path>" to create a development
# environment. This will only work on python base versions that support all
# large_image packages.
[testenv:dev]
description = Setup dev environment
usedevelop = true
deps = -rrequirements-dev.txt
commands =
pip freeze
[testenv:dev-osx]
description = {[testenv:dev]description}
use_deveop = {[testenv:dev]use_deveop}
deps = -rrequirements-dev-osx.txt
commands = {[testenv:dev]commands}
[testenv:dev-py{38,39,310,311,312,313}]
usedevelop = true
deps = {[testenv:dev]deps}
commands = {[testenv:dev]commands}
[testenv:dev-osx-py{38,39,310,311,312,313}]
usedevelop = true
deps = {[testenv:dev-osx]deps}
commands = {[testenv:dev-osx]commands}
[testenv:docs]
description = Build documentation
deps =
-rrequirements-test.txt
jupyter
linkchecker
nbsphinx
pypandoc
sphinx
sphinx-rtd-theme
sphinxcontrib-jquery
sphinxcontrib-mermaid
pooch
changedir = {toxinidir}/docs
allowlist_externals =
make_docs.sh
commands =
./make_docs.sh
linkchecker "{toxinidir}/build/docs/index.html"
[testenv:compare]
description = Compare inputs with different sources
passenv = PIP_*
setenv =
PIP_FIND_LINKS={env:PIP_FIND_LINKS:https://girder.github.io/large_image_wheels}
PIP_PREFER_BINARY=1
GDAL_PAM_ENABLED=no
GDAL_HTTP_MAX_RETRY=5
GDAL_HTTP_RETRY_DELAY=5
deps =
-rrequirements-test-core.txt
pooch
commands =
python -c "import test.datastore;test.datastore.fetch_all()"
python {toxinidir}/test/lisource_compare.py --all build/tox/externaldata/* 'https://data.kitware.com/api/v1/file/hashsum/sha512/5e56cdb8fb1a02615698a153862c10d5292b1ad42836a6e8bce5627e93a387dc0d3c9b6cfbd539796500bc2d3e23eafd07550f8c214e9348880bbbc6b3b0ea0c/download' test/test_files/rgb*.tiff --projection= --projection=EPSG:3857 --yaml=build/tox/compare.yaml --out=build/tox/compare.txt
[testenv:compare-py{38,39,310,311,312,313}]
description = {[testenv:compare]description}
passenv = {[testenv:compare]passenv}
setenv = {[testenv:compare]setenv}
deps = {[testenv:compare]deps}
commands = {[testenv:compare]commands}
[isort]
line_length = 100
wrap_length = 79
[flake8]
max-line-length = 100
show-source = True
format = pylint
max-complexity = 14
exclude =
build
docs
*/web_client/*
*/*egg*/*
# Ignore missing docstring errors.
ignore = D100,D101,D102,D103,D104,D105,D106,D107,D200,D205,D400,D401,E741,W504,B017,C408
per-file-ignores = docs/*.py: E501
[pytest]
addopts = --verbose --strict-markers --showlocals --cov-report="term" --cov-report="xml" --cov-report="html" --cov --ignore test/utils
# --cov-context=test
cache_dir = build/pytest_cache
testpaths =
test
girder/test_girder
girder_annotation/test_annotation
sources/dicom/test_dicom
markers =
singular: mark a test to run in a non-parallel environment.
girder: mark a test as requiring girder
girder_client: mark a test as requiring girder client
notebook: mark a test as for jupyter notebooks
plugin: use by girder to load plugins
# Some of these warnings are filtered by their own packages (e.g., the numpy
# warnings), and pytest shows them anyway unless they are listed here. Others,
# such as the mongo warnings, we can't do anything about as this package has no
# stake in the version of pymongo used by Girder. The setName() deprecation
# will likely become an error in Python 3.11, but we'd expect dependent
# libraries to catch up.
filterwarnings =
ignore::pytest.PytestUnraisableExceptionWarning
ignore:.*count is deprecated.*:DeprecationWarning
ignore::DeprecationWarning:.*mongo.*
ignore::DeprecationWarning:.*cheroot.*
ignore::UserWarning:pymongo.collection
ignore::DeprecationWarning:bioformats.formatreader
ignore:.*numpy.dtype size changed.*
ignore:.*numpy.ufunc size changed.*
ignore:.*numpy.ndarray size changed.*
ignore:.*Unrecognized box.*:UserWarning:glymur.*
ignore:.*SetUnitType.*not supported on this raster band.*
ignore::pytest.PytestUnhandledThreadExceptionWarning:cachetools.*
ignore:::celery.backends.amqp
ignore:Creating a LegacyVersion.*:DeprecationWarning
ignore:setName\(\) is deprecated, set the name attribute instead:DeprecationWarning
[coverage:paths]
# As of pytest-cov 2.6, all but the first source line is relative to the first
# source line. The first line is relative to the local path. Prior to 2.6,
# all lines were relative to the local path.
source =
large_image
../examples
../girder/girder_large_image
../girder_annotation/girder_large_image_annotation
../sources
../utilities/converter
../utilities/tasks
[coverage:run]
data_file = build/coverage/.coverage
branch = True
omit =
test/*
sources/dicom/test_dicom/*
include =
large_image/*
examples/*
girder/girder_large_image/*
girder_annotation/girder_large_image_annotation/*
sources/*
utilities/converter/*
utilities/tasks*
parallel = True
[coverage:html]
directory = build/test/artifacts/python_coverage
title = Large image Coverage Report
# show_contexts = True
[coverage:xml]
output = build/test/coverage/py_coverage.xml
[mypy]
python_version = 3.8
install_types = true
non_interactive = true
ignore_missing_imports = true
follow_imports = silent
# Turn these all to true as we can
strict = True
# Start off with these
warn_unused_configs = True
warn_redundant_casts = True
warn_unused_ignores = True
# Getting these passing should be easy
strict_equality = True
strict_concatenate = True
# Strongly recommend enabling this one as soon as you can
check_untyped_defs = True
# These shouldn't be too much additional work, but may be tricky to
# get passing if you use a lot of untyped libraries
disallow_subclassing_any = True
disallow_untyped_decorators = True
disallow_any_generics = False
# These next few are various gradations of forcing use of type annotations
disallow_untyped_calls = False
disallow_incomplete_defs = False
disallow_untyped_defs = False
# This one isn't too hard to get passing, but return on investment is lower
no_implicit_reexport = False
# This one can be tricky to get passing if you use a lot of untyped libraries
warn_return_any = False
files =
large_image/
# sources/,
# girder/,
# girder_annotation/,
# utilities/
exclude = (?x)(
(^|/)build/
| (^|/)docs/
| (^|/)examples/
| (^|/).*\.egg-info/
| (^|/)setup\.py$
| (^|/)test/
| (^|/)test_.*/
)
[yamlfix]
line_length = 200
preserve_quotes = True
sequence_style = YamlNodeStyle = YamlNodeStyle.BLOCK_STYLE