Repository navigation
Expand file tree
/
Copy pathtox.ini
More file actions
292 lines (230 loc) · 7.32 KB
/
Copy pathtox.ini
File metadata and controls
292 lines (230 loc) · 7.32 KB
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
[tox]
# https://github.com/tox-dev/tox/issues/3238
requires = tox >=4.39
envlist =
lint
numpy-tests
cupy-tests
pytorch-tests
torch-tests
jax-tests
metatomic-tests
docs-tests
cxx-tests
fortran-tests
torch-cxx-tests
single-build-tests
[testenv]
lint-folders = python setup.py
package = external
package_env = build-vesin
build_single_wheel = --no-deps --force-reinstall --no-build-isolation --check-build-dependencies
# this warning fires when collecting tests and seemingly can not be
# supressed by the code in pyproject.toml, so we add it as a CLI flag
test_args =
-W "ignore:`torch.jit.script` is not supported in Python 3.14+ and may break:"
packaging_deps =
cmake
setuptools >= 77
torch_deps =
torch=={env:VESIN_TESTS_TORCH_VERSION:2.15}.*
jax_deps =
jax=={env:VESIN_TESTS_JAX_VERSION:0.12}.*
jaxlib=={env:VESIN_TESTS_JAX_VERSION:0.12}.*
metatomic_deps =
metatomic-torch >=0.1,<0.2
# this may pin an older torch version, since metatomic-torch is not always
# compatible with the same torch versions as vesin
torch=={env:VESIN_TESTS_TORCH_VERSION:2.15}.*
[testenv:check-cuda-available]
description = Tests that CUDA is available in PyTorch and CuPy
package = skip
passenv = *
deps =
torch=={env:VESIN_TESTS_TORCH_VERSION:2.15}.*
allowlist_externals = bash
commands =
bash ./scripts/install-cupy.sh
python -c "import torch; assert(torch.cuda.is_available() and torch.version.cuda)"
python -c "import cupy as cp; cp.cuda.Device(0).compute_capability"
[testenv:build-vesin]
passenv = *
deps =
{[testenv]packaging_deps}
commands =
pip wheel python/vesin --no-deps --no-build-isolation --check-build-dependencies --wheel-dir {envtmpdir}/dist
[testenv:numpy-tests]
passenv = *
description = Run the Python tests for vesin with numpy arrays
deps =
pytest
pytest-timeout
ase
allowlist_externals = bash
changedir = python/vesin
commands =
pytest {[testenv]test_args} {posargs}
[testenv:cupy-tests]
passenv = *
description = Run the Python tests for vesin with cupy arrays
deps =
pytest
pytest-timeout
ase
allowlist_externals = bash
changedir = python/vesin
commands =
bash ../../scripts/install-cupy.sh
pytest {[testenv]test_args} {posargs}
[testenv:pytorch-tests]
passenv = *
description = Run the tests of vesin with PyTorch arrays
deps =
pytest
pytest-timeout
ase
{[testenv]torch_deps}
changedir = python/vesin
commands =
pytest {[testenv]test_args} {posargs}
[testenv:torch-tests]
passenv = *
description = Run the tests of the vesin-torch Python package
deps =
{[testenv]packaging_deps}
pytest
{[testenv]torch_deps}
changedir = python/vesin_torch
commands =
pip install {[testenv]build_single_wheel} .
# Make torch.autograd.gradcheck works with pytest
python {toxinidir}/scripts/pytest-dont-rewrite-torch.py
pytest {[testenv]test_args} {posargs}
[testenv:jax-tests]
passenv = *
description = Run the tests of the vesin-jax Python package
deps =
{[testenv]packaging_deps}
pytest
ase
{[testenv]jax_deps}
changedir = python/vesin_jax
commands =
pip install {[testenv]build_single_wheel} .
pytest {[testenv]test_args} {posargs}
[testenv:metatomic-tests]
passenv = *
description = Run the tests of the vesin / metatomic interface
deps =
{[testenv]packaging_deps}
pytest
ase
{[testenv]metatomic_deps}
changedir = python/vesin
commands =
pip install {[testenv]build_single_wheel} .
pytest {[testenv]test_args} {posargs} tests/test_metatomic.py
[testenv:docs-tests]
passenv = *
package = skip
description = Check that the documentation examples work
deps =
{[testenv]packaging_deps}
pytest
pytest-custom_exit_code
{[testenv]metatomic_deps}
{[testenv]jax_deps}
commands =
pip install {[testenv]build_single_wheel} python/vesin
pip install {[testenv]build_single_wheel} python/vesin_torch
pip install {[testenv]build_single_wheel} python/vesin_jax
pytest {[testenv]test_args} --suppress-no-test-exit-code --doctest-modules --pyargs vesin
pytest {[testenv]test_args} --suppress-no-test-exit-code --doctest-modules --pyargs vesin_torch
pytest {[testenv]test_args} --suppress-no-test-exit-code --doctest-modules --pyargs vesin_jax
[testenv:cxx-tests]
passenv = *
description = Run the C++ tests
package = skip
deps = cmake
commands =
cmake -B {envdir}/build -S vesin -DVESIN_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug
cmake --build {envdir}/build --config Debug
ctest --test-dir {envdir}/build --build-config Debug --output-on-failure
[testenv:torch-cxx-tests]
passenv = *
description = Run the C++ tests of vesin-torch
package = skip
deps =
{[testenv]packaging_deps}
{[testenv]torch_deps}
allowlist_externals = bash
commands =
# the Python package is used to generate the models used by the tests
pip install {[testenv]build_single_wheel} python/vesin_torch
# use $TOX_ENV_DIR instead of {envdir}, since bash would interpret the
# backslashes in Windows paths
bash -c "cmake -B $TOX_ENV_DIR/build -S vesin-torch \
-DVESIN_TORCH_BUILD_TESTS=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DPython_EXECUTABLE=$(python -c 'import sys; print(sys.executable)') \
-DCMAKE_PREFIX_PATH=$(python -c 'import torch; print(torch.utils.cmake_prefix_path)')"
cmake --build {envdir}/build --config Debug
ctest --test-dir {envdir}/build --build-config Debug --output-on-failure --timeout 300
[testenv:single-build-tests]
passenv = *
description = Check that the single file can be created and compiled
package = skip
deps = cmake
commands =
python ./vesin/scripts/create-single-cpp.py
cmake -B {envdir}/build -S vesin/tests/single-cpp -DSINGLE_BUILD_DIR={toxinidir}/vesin/dist/
cmake --build {envdir}/build --config Debug
[testenv:fortran-tests]
passenv = *
description = Run the Fortran tests
package = skip
deps = cmake
commands =
cmake -B {envdir}/build -S fortran -DVESIN_FORTRAN_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug
cmake --build {envdir}/build --config Debug
ctest --test-dir {envdir}/build --build-config Debug --output-on-failure
[testenv:lint]
description = Run linters and formatter
package = skip
deps =
ruff
allowlist_externals = bash
commands =
ruff format --diff {[testenv]lint-folders}
ruff check {[testenv]lint-folders}
python ./scripts/lint-integer-types.py
[testenv:format]
description = Abuse tox to do actual formatting on all files.
package = skip
deps =
ruff
allowlist_externals = bash
commands =
ruff format {[testenv]lint-folders}
ruff check --fix-only {[testenv]lint-folders}
[testenv:docs]
passenv = *
package = skip
description = Invoke sphinx-build to build the HTML docs
deps =
sphinx
breathe >=4.33 # C++ => sphinx through doxygen
furo # sphinx theme
sphinx-design # helpers for nicer docs website (tabs, grids, cards, …)
ford == 7.0.*
{[testenv]jax_deps}
{[testenv]metatomic_deps}
cmake
setuptools >= 77
wheel >= 0.41
commands =
pip install {[testenv]build_single_wheel} python/vesin
pip install {[testenv]build_single_wheel} python/vesin_torch
pip install {[testenv]build_single_wheel} python/vesin_jax
sphinx-build -d docs/build/doctrees -W -b html docs/src docs/build/html
ford fortran/docs.md --output_dir=../docs/build/html/fortran/