Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sage
Path: blob/develop/src/tox.ini
7339 views
1
## Configuration for tox.
2
## Needs tox installed in the system python.
3
##
4
## doctest: Run the sage doctests. From the SAGE_ROOT/src directory:
5
##
6
## $ tox
7
##
8
## Arguments are passed on to "sage -t":
9
##
10
## $ tox sage/geometry
11
##
12
## To pass on options to "sage -t", use -- to separate it from tox options:
13
##
14
## $ tox -- --verbose --optional=sage,pynormaliz --long sage/geometry
15
##
16
## pycodestyle:
17
##
18
## $ tox -e pycodestyle
19
##
20
## Note that on the first run, tox automatically installs pycodestyle
21
## in a virtual environment.
22
##
23
[tox]
24
envlist = doctest, coverage, startuptime, pycodestyle-minimal, relint, codespell, rst
25
# When adding environments above, also update the delegations in SAGE_ROOT/tox.ini
26
skipsdist = true
27
28
requires =
29
# For the renamed "allowlist_externals" keyword, need >= 3.18
30
# Because of https://github.com/tox-dev/tox/issues/3238, need <4.14.1
31
tox>=3.18
32
tox<4.14.1
33
34
[sagedirect]
35
# Base for tox environments that bypass the virtual environment set up by tox,
36
# calling sage directly.
37
passenv =
38
HOME
39
setenv =
40
SAGE={toxinidir}/../sage
41
envdir={toxworkdir}/sagedirect
42
allowlist_externals =
43
{env:SAGE}
44
45
[testenv:doctest]
46
description =
47
run the Sage doctester (same as "sage -t")
48
## This toxenv bypasses the virtual environment set up by tox.
49
passenv = {[sagedirect]passenv}
50
setenv = {[sagedirect]setenv}
51
envdir = {[sagedirect]envdir}
52
allowlist_externals = {[sagedirect]allowlist_externals}
53
commands =
54
{env:SAGE} -t -p 0 {posargs:--all}
55
56
[testenv:coverage.py]
57
# https://coverage.readthedocs.io/en/latest/index.html
58
description =
59
run the Sage doctester with Coverage.py
60
## This toxenv bypasses the virtual environment set up by tox.
61
passenv = {[sagedirect]passenv}
62
setenv = {[sagedirect]setenv}
63
envdir = {[sagedirect]envdir}
64
allowlist_externals = {[sagedirect]allowlist_externals}
65
commands_pre =
66
{env:SAGE} -pip install -U coverage
67
commands =
68
{env:SAGE} --python -m coverage run "{toxinidir}/../venv/bin/sage-runtests" -p 0 {posargs:--all}
69
commands_post =
70
{env:SAGE} --python -m coverage combine
71
{env:SAGE} --python -m coverage report
72
73
[testenv:coverage.py-html]
74
# https://coverage.readthedocs.io/en/latest/index.html
75
description =
76
run the Sage doctester with Coverage.py, generate HTML report
77
## This toxenv bypasses the virtual environment set up by tox.
78
passenv = {[sagedirect]passenv}
79
setenv = {[sagedirect]setenv}
80
envdir = {[sagedirect]envdir}
81
allowlist_externals = {[sagedirect]allowlist_externals}
82
commands_pre =
83
{env:SAGE} -pip install -U coverage
84
commands =
85
{env:SAGE} --python -m coverage run "{toxinidir}/../venv/bin/sage-runtests" -p 0 {posargs:--all}
86
commands_post =
87
{env:SAGE} --python -m coverage combine
88
{env:SAGE} --python -m coverage report
89
{env:SAGE} --python -m coverage html -d "{envdir}"
90
91
[testenv:coverage.py-xml]
92
# https://coverage.readthedocs.io/en/latest/index.html
93
description =
94
run the Sage doctester with Coverage.py, generate XML report
95
## This toxenv bypasses the virtual environment set up by tox.
96
passenv = {[sagedirect]passenv}
97
setenv = {[sagedirect]setenv}
98
envdir = {[sagedirect]envdir}
99
allowlist_externals = {[sagedirect]allowlist_externals}
100
commands_pre =
101
{env:SAGE} -pip install -U coverage
102
commands =
103
{env:SAGE} --python -m coverage run "{toxinidir}/../venv/bin/sage-runtests" -p 0 {posargs:--all}
104
commands_post =
105
{env:SAGE} --python -m coverage combine
106
{env:SAGE} --python -m coverage report
107
{env:SAGE} --python -m coverage xml -o "{envdir}/coverage.xml"
108
109
[testenv:coverage]
110
description =
111
give information about doctest coverage of files
112
(same as "sage --coverage[all]")
113
## This toxenv bypasses the virtual environment set up by tox.
114
passenv = {[sagedirect]passenv}
115
setenv = {[sagedirect]setenv}
116
envdir = {[sagedirect]envdir}
117
allowlist_externals = {[sagedirect]allowlist_externals}
118
commands =
119
{env:SAGE} --coverage {posargs:--all}
120
121
[testenv:startuptime]
122
description =
123
display how long each component of Sage takes to start up
124
(same as "sage --startuptime")
125
## This toxenv bypasses the virtual environment set up by tox.
126
passenv = {[sagedirect]passenv}
127
setenv = {[sagedirect]setenv}
128
envdir = {[sagedirect]envdir}
129
allowlist_externals = {[sagedirect]allowlist_externals}
130
commands =
131
{env:SAGE} --startuptime {posargs}
132
133
[testenv:pyright]
134
description =
135
run the static typing checker pyright
136
deps = pyright
137
setenv =
138
{[sagedirect]setenv}
139
HOME={envdir}
140
# Fix version, see .github/workflows/build.yml
141
PYRIGHT_PYTHON_FORCE_VERSION=1.1.232
142
allowlist_externals = {[sagedirect]allowlist_externals}
143
## We run pyright from within the sage-env so that SAGE_LOCAL is available.
144
## pyright is already configured via SAGE_ROOT/pyrightconfig.json to use our venv.
145
##
146
## Running pyright on the whole Sage source tree takes very long
147
## and may run out of memory. When no files/directories are given, just run it
148
## on the packages that already have typing annotations.
149
commands =
150
{env:SAGE} -sh -c 'pyright {posargs:{toxinidir}/sage/combinat {toxinidir}/sage/manifolds}'
151
152
[testenv:pycodestyle]
153
description =
154
check against the Python style conventions of PEP8
155
deps = pycodestyle
156
commands = pycodestyle {posargs:{toxinidir}/sage/}
157
158
[testenv:pycodestyle-minimal]
159
description =
160
check against Sage minimal style conventions
161
# Check for the following issues:
162
# E111: indentation is not a multiple of four
163
# E211: whitespace before '('
164
# E271: multiple spaces after keyword
165
# E305: expected 2 blank lines after class or function definition, found 1
166
# E306: expected 1 blank line before a nested definition, found 0
167
# E401: multiple imports on one line
168
# E502 the backslash is redundant between brackets
169
# E701: multiple statements on one line (colon)
170
# E702: multiple statements on one line (semicolon)
171
# E703: statement ends with a semicolon
172
# E711: comparison to None should be ‘if cond is None:’
173
# E712: comparison to True should be ‘if cond is True:’ or ‘if cond:’
174
# E713 test for membership should be ’not in’
175
# E721: do not compare types, use isinstance()
176
# E722: do not use bare except, specify exception instead
177
# W291: trailing whitespace
178
# W293: blank line contains whitespace
179
# W391: blank line at end of file
180
# W605: invalid escape sequence ‘x’
181
# See https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
182
deps = pycodestyle
183
commands =
184
pycodestyle --select E111,E115,E21,E221,E222,E225,E227,E228,E25,E271,E272,E275,E302,E303,E305,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605 {posargs:{toxinidir}/sage/}
185
pycodestyle --select E111,E222,E271,E301,E302,E303,E305,E306,E401,E502,E703,E712,E713,E714,E72,W29,W391,W605, --filename *.pyx {posargs:{toxinidir}/sage/}
186
187
[pycodestyle]
188
max-line-length = 160
189
statistics = True
190
191
[testenv:relint]
192
description =
193
check whether some forbidden patterns appear
194
# https://github.com/codingjoe/relint
195
# The patterns are in .relint.yml
196
deps = relint
197
allowlist_externals = find
198
commands = find {posargs:{toxinidir}/sage/} \
199
-name "*\#*" -prune -o \
200
-name "*.a" -prune -o \
201
-name "*.bak" -prune -o \
202
-name "*.bz2" -prune -o \
203
-name "*.dia" -prune -o \
204
-name "*.gz" -prune -o \
205
-name "*.ico" -prune -o \
206
-name "*.inv" -prune -o \
207
-name "*.JPEG" -prune -o \
208
-name "*.jpeg" -prune -o \
209
-name "*.JPG" -prune -o \
210
-name "*.jpg" -prune -o \
211
-name "*.log" -prune -o \
212
-name "*.o" -prune -o \
213
-name "*.orig" -prune -o \
214
-name "*.PDF" -prune -o \
215
-name "*.pdf" -prune -o \
216
-name "*.PNG" -prune -o \
217
-name "*.png" -prune -o \
218
-name "*.pyc" -prune -o \
219
-name "*.so" -prune -o \
220
-name "*.sobj" -prune -o \
221
-name "*.sws" -prune -o \
222
-name "*.tar" -prune -o \
223
-name "*.tgz" -prune -o \
224
-name "*.xz" -prune -o \
225
-name "*.zip" -prune -o \
226
-name "*~*" -prune -o \
227
-name ".DS_Store" -prune -o \
228
-exec relint -c {toxinidir}/.relint.yml \{\} +
229
230
[testenv:codespell]
231
description =
232
check for misspelled words in source code
233
# https://pypi.org/project/codespell/
234
deps = codespell
235
commands = codespell \
236
--skip="*\#*,*.a,*.bak,*.bz2,*.dia,*.gz,*.ico,*.inv,*.JPEG,*.jpeg" \
237
--skip="*.JPG,*.jpg,*.log,*.o,*.orig,*.PDF,*.pdf,*.PNG,*.png,*.pyc" \
238
--skip="*.so,*.sobj,*.sws,*.tar,*.tgz,*.xz,*.zip,*~*,.DS_Store" \
239
--skip="doc/ca,doc/de,doc/es,doc/fr,doc/hu,doc/it,doc/ja,doc/pt,doc/ru,doc/tr" \
240
--skip="src/doc/ca,src/doc/de,src/doc/es,src/doc/fr,src/doc/hu" \
241
--skip="src/doc/it,src/doc/ja,src/doc/pt,src/doc/ru,src/doc/tr" \
242
--skip=".git,.tox,autom4te.cache,cythonized,dist,lib.*,local" \
243
--skip="logs,scripts-3,tmp,upstream,worktree*,*.egg-info" \
244
--dictionary=- \
245
--dictionary={toxinidir}/.codespell-dictionary.txt \
246
--ignore-words={toxinidir}/.codespell-ignore.txt \
247
{posargs:{toxinidir}/sage/}
248
249
[testenv:rst]
250
description =
251
validate Python docstrings markup as reStructuredText
252
deps = flake8-rst-docstrings
253
commands = flake8 --select=RST {posargs:{toxinidir}/sage/}
254
255
[testenv:cython-lint]
256
description =
257
check Cython files for code style
258
deps = cython-lint
259
commands = cython-lint --no-pycodestyle {posargs:{toxinidir}/sage/}
260
261
[flake8]
262
rst-roles =
263
# Sphinx
264
doc,
265
file,
266
ref,
267
# Sphinx - https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#the-standard-domain (selection)
268
envvar,
269
# Sphinx - https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#cross-referencing-python-objects
270
attr,
271
class,
272
const,
273
data,
274
exc,
275
func,
276
kbd,
277
meth,
278
mod,
279
obj,
280
# from src/sage/misc/sagedoc.py
281
arxiv,
282
doi,
283
mathscinet,
284
oeis,
285
pari,
286
python,
287
issue,
288
wikipedia,
289
common_lisp,
290
ecl,
291
gap,
292
gap_package,
293
giac_cascmd,
294
giac_us,
295
maxima,
296
meson,
297
polymake,
298
ppl,
299
qepcad,
300
scip,
301
singular,
302
soplex
303
rst-directives =
304
attribute,
305
automethod,
306
autofunction,
307
toctree,
308
MODULEAUTHOR,
309
ONLY,
310
PLOT,
311
SEEALSO,
312
TODO
313
extend-ignore =
314
# Ignore RST306 Unknown target name -- because of references to the global bibliography
315
RST306
316
exclude =
317
# Avoid errors by exclude files with generated docstring portions such as {PLOT_OPTIONS_TABLE}
318
sage/combinat/designs/database.py
319
sage/graphs/graph_plot.py
320
sage/misc/sagedoc.py
321
322
[coverage:run]
323
source = sage
324
concurrency = multiprocessing,thread
325
data_file = .coverage/.coverage
326
disable_warnings =
327
no-data-collected
328
module-not-measured
329
330
[coverage:report]
331
ignore_errors = True
332
skip_empty = True
333
334