forked from OpenCyphal/nunavut
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
255 lines (206 loc) · 5.41 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
#
# The standard version to develop against is 3.10.
#
[tox]
envlist = {py37,py38,py39,py310,py311}-{test,nnvg,doctest,rstdoctest},lint,report,docs
[base]
deps =
Sybil >= 3.0.0, < 4.0.0
pytest >= 5.4.3, < 7.0.0
pytest-timeout
coverage
types-PyYAML
[dev]
deps =
{[base]deps}
autopep8
rope
isort
# +---------------------------------------------------------------------------+
# | CONFIGURATION
# +---------------------------------------------------------------------------+
[flake8]
max-complexity = 10
max-line-length = 120
doctests = True
statistics = True
show-source = True
ignore = E203, W503
[pytest]
log_file = pytest.log
log_level = DEBUG
log_cli = true
log_cli_level = WARNING
addopts: --keep-generated
norecursedirs = submodules .* build* verification .tox
# The fill fixtures deprecation warning comes from Sybil, which we don't have any control over. Remove when updated.
filterwarnings =
error
ignore:A private pytest class or function was used.:DeprecationWarning
[coverage:run]
branch=True
parallel=True
include =
src/nunavut/*
.tox/*/site-packages/nunavut/*
omit =
*/jinja2/*
*/markupsafe/*
*/setup.py
*/conf.py
*/embed_jinja.py
[coverage:paths]
source =
src
.tox/*/site-packages
.tox/*/bin
[coverage:report]
exclude_lines =
pragma: no cover
def __repr__
raise AssertionError
raise NotImplementedError
assert False
if False:
if __name__ == .__main__.:
[doc8]
max-line-length = 120
verbose = 1
[mypy]
# Python version is not specified to allow checking against different versions
warn_return_any = True
warn_unused_configs = True
disallow_untyped_defs = True
check_untyped_defs = True
no_implicit_optional = True
warn_redundant_casts = True
warn_unused_ignores = True
show_error_context = True
mypy_path = src
[mypy-pydsdl]
ignore_missing_imports = True
[mypy-nunavut.jinja.jinja2.*]
follow_imports = skip
[mypy-pytest.*]
ignore_missing_imports = True
[mypy-sybil.*]
ignore_missing_imports = True
[mypy-setuptools.*]
ignore_missing_imports = True
[mypy-importlib_resources.*]
ignore_missing_imports = True
# +---------------------------------------------------------------------------+
# | TOX ENVIRONMENTS
# +---------------------------------------------------------------------------+
[testenv]
usedevelop = true
setenv =
PYTHONDONTWRITEBYTECODE=1
PYTHONPATH={toxinidir}/test
passenv =
GITHUB
GITHUB_*
deps =
test,nnvg,doctest,rstdoctest: {[base]deps}
commands =
nnvg: coverage run \
nnvg: -m nunavut \
nnvg: -O {envtmpdir} \
nnvg: --target-language cpp \
nnvg: --experimental-languages \
nnvg: -v \
nnvg: --dry-run \
nnvg: {toxinidir}/submodules/public_regulated_data_types/uavcan
test: coverage run \
test: -m pytest {posargs} --basetemp={envtmpdir} -p "no:cacheprovider" \
test: --junit-xml={envtmpdir}/xunit-result.xml \
test: --rootdir={toxinidir} \
test: {toxinidir}/test
doctest: coverage run \
doctest: -m pytest {posargs} --basetemp={envtmpdir} -p "no:cacheprovider" \
doctest: --rootdir={toxinidir} \
doctest: {toxinidir}/src
rstdoctest: pytest {posargs} --basetemp={envtmpdir} -p "no:cacheprovider" \
rstdoctest: --rootdir={toxinidir} \
rstdoctest: {toxinidir}/docs
[testenv:docs]
deps =
-rrequirements.txt
sphinx ~= 6.2.1
sphinx-rtd-theme
readthedocs-sphinx-ext
commands =
sphinx-build -W -b html {toxinidir} {envtmpdir}
[testenv:gen-apidoc]
allowlist_externals = rm
deps =
sphinx-autoapi
commands =
rm -rf {toxinidir}/docs/api
sphinx-apidoc \
--doc-project library \
--output-dir {toxinidir}/docs/api \
--ext-autodoc \
--ext-intersphinx \
--templatedir={toxinidir}/docs/sphinx_templates/apidoc \
--tocfile=library \
--module-first \
src \
"**/conftest.py" \
"src/nunavut/jinja/jinja2/**" \
"src/nunavut/jinja/markupsafe/**"
[testenv:report]
deps = coverage
skip_install = true
commands =
coverage combine --append
coverage html -d {envtmpdir}
coverage xml -o {envtmpdir}/coverage.xml
[testenv:lint]
basepython = python3.10
deps =
{[dev]deps}
black
flake8
doc8
Pygments
mypy
lxml
types-pkg_resources
types-PyYAML
commands =
flake8 --benchmark --tee --output-file={envtmpdir}/flake8.txt --filename=*.py --exclude=**/jinja2/*,**/markupsafe/* src
black --check --line-length 120 --force-exclude '(/jinja2/|/markupsafe\/)' src
doc8 {toxinidir}/docs
mypy -m nunavut \
-m nunavut.jinja \
-p nunavut.lang \
--cache-dir {envtmpdir} \
--txt-report {envtmpdir}/mypy-report-lib \
--config-file {toxinidir}/tox.ini
[testenv:package]
deps =
wheel
twine
commands =
python setup.py \
sdist -d {toxworkdir}/package/dist \
bdist_wheel -d {toxworkdir}/package/dist \
-b {envtmpdir}/tmp \
-k \
--build-number {env:GITHUB_RUN_ID:0}
twine check {toxworkdir}/package/dist/*
[testenv:local]
usedevelop = true
deps =
{[base]deps}
{[dev]deps}
{[testenv:docs]deps}
{[testenv:lint]deps}
commands =
mypy -m nunavut \
-m nunavut.jinja \
-p nunavut.lang \
--config-file {toxinidir}/tox.ini \
--install-types \
--non-interactive