This repository has been archived by the owner on Jan 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
tox.ini
200 lines (185 loc) · 5.44 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
;Blue Brain Search is a text mining toolbox focused on scientific use cases.
;
;Copyright (C) 2020 Blue Brain Project, EPFL.
;
;This program is free software: you can redistribute it and/or modify
;it under the terms of the GNU Lesser General Public License as published by
;the Free Software Foundation, either version 3 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU Lesser General Public License for more details.
;
;You should have received a copy of the GNU Lesser General Public License
;along with this program. If not, see <https://www.gnu.org/licenses/>.
[tox]
minversion = 3.1.0
requires = virtualenv >= 20.0.0
sources = setup.py src/bluesearch tests benchmarks data_and_models
envlist = lint, type, py{38, 39, 310}, docs, check-apidoc, check-packaging
; Enable PEP-517/518, https://tox.wiki/en/latest/config.html#conf-isolated_build
isolated_build = true
[testenv]
description = Run pytest
download = true
extras = dev
allowlist_externals = docker
commands =
python -m spacy download en_core_web_sm
pytest -m "" {posargs:tests}
[testenv:lint]
description = Lint using flake8, black, isort and bandit
basepython = python3.8
skip_install = true
deps =
bandit==1.7.0
black==22.3.0
flake8==3.9.2
flake8-bugbear==21.4.3
flake8-comprehensions==3.5.0
flake8-docstrings==1.6.0
isort==5.9.1
commands =
flake8 {posargs:{[tox]sources}}
isort --check {posargs:{[tox]sources}}
black --check {posargs:{[tox]sources}}
bandit -qr --exclude "benchmarks/,tests/,data_and_models/pipelines/ner/transformers_vs_spacy/transformers/" \
{posargs:{[tox]sources}}
[testenv:type]
description = Run static type checks using mypy
basepython = python3.8
skip_install = true
deps =
mypy==0.910
pandas-stubs==1.2.0.1
sqlalchemy-stubs==0.4
types-PyYAML==5.4.3
types-requests==2.25.0
types-setuptools==57.0.0
typing-extensions==3.10.0.0
commands =
mypy {posargs:{[tox]sources}}
[testenv:format]
description = Apply black and isort
basepython = python3.8
skip_install = true
deps =
black==22.3.0
isort==5.8.0
commands =
isort {posargs:{[tox]sources}}
black {posargs:{[tox]sources}}
[testenv:docs]
description = Build docs and run doctest
basepython = python3.8
changedir = docs
extras = dev
allowlist_externals = make
# set warnings as errors using the -W sphinx option
commands =
make clean
make doctest SPHINXOPTS=-W
make html SPHINXOPTS=-W
[testenv:apidoc]
description = Re-generate the API docs
skip_install = true
allowlist_externals = rm
deps = sphinx
commands =
rm -r docs/source/api
sphinx-apidoc -Tefo docs/source/api src/bluesearch src/bluesearch/version.py
[testenv:check-apidoc]
description = Check that the API docs are up-to-date
skip_install = true
allowlist_externals = diff
deps = sphinx
commands =
sphinx-apidoc -Tefo {envtmpdir} src/bluesearch src/bluesearch/version.py
diff {envtmpdir} docs/source/api
[testenv:check-packaging]
description = Generate source and wheel dists and run twine checks
basepython = python3.8
deps =
setuptools-scm
wheel
twine
commands =
python setup.py sdist bdist_wheel -d {envtmpdir}/dist
twine check {envtmpdir}/dist/*
[testenv:benchmarks]
description = Run pytest benchmark tests
download = true
extras = dev
deps = pygal
allowlist_externals = echo
passenv =
EMBEDDING_SERVER
MINING_SERVER
MYSQL_SERVER
SEARCH_SERVER
commands =
echo EMBEDDING_SERVER={env:EMBEDDING_SERVER:}
echo MINING_SERVER={env:MINING_SERVER:}
echo MYSQL_SERVER={env:MYSQL_SERVER:}
echo SEARCH_SERVER={env:SEARCH_SERVER:}
pytest \
--benchmark-only \
--benchmark-group-by=func \
--no-cov \
--benchmark-min-rounds=1 \
--embedding_server="{env:EMBEDDING_SERVER:}" \
--mining_server="{env:MINING_SERVER:}" \
--mysql_server="{env:MYSQL_SERVER:}" \
--search_server="{env:SEARCH_SERVER:}" \
{posargs} \
benchmarks
[pytest]
testpaths = tests
# reason for the ignore: https://github.com/docker/docker-py/issues/2928
filterwarnings =
error
ignore::DeprecationWarning:docker.*:
ignore::DeprecationWarning:luigi.task:
ignore::DeprecationWarning:transformers.image_utils.*:
ignore::elastic_transport.SecurityWarning
ignore::urllib3.exceptions.InsecureRequestWarning
ignore::luigi.parameter.UnconsumedParameterWarning:
addopts =
--cov
--cov-config=tox.ini
--no-cov-on-fail
--durations=20
--verbosity=1
--last-failed-no-failures=all
-m "not slow and not network"
-p no:unraisableexception
markers =
network: tests that require a network connection
slow: tests that are slow
[coverage:run]
source = bluesearch
branch = True
[coverage:report]
fail_under = 80
skip_covered = False
show_missing = False
[flake8]
count = False
extend-exclude =
data_and_models/pipelines/sentence_embedding/training_transformers/
data_and_models/pipelines/ner/transformers_vs_spacy/transformers/
max-line-length = 88
extend-ignore = E203
docstring-convention = numpy
per-file-ignores =
tests/*:D
benchmarks/*:D
[isort]
profile = black
honor_noqa = true
known_third_party = docker
extend_skip =
data_and_models/pipelines/sentence_embedding/training_transformers/
data_and_models/pipelines/ner/transformers_vs_spacy/transformers/