forked from lab-cosmo/sphericart
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtox.ini
More file actions
230 lines (177 loc) · 5.34 KB
/
tox.ini
File metadata and controls
230 lines (177 loc) · 5.34 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
[tox]
# https://github.com/tox-dev/tox/issues/3238
requires = tox==4.14.0
# these are the default environments, i.e. the list of tests running when you
# execute `tox` in the command-line without anything else
envlist =
lint
tests
torch-tests
examples
jax-tests
[testenv]
skip_install = True
passenv =
*
allowlist_externals =
bash
pip_install_flags = --no-deps --no-cache --no-build-isolation --check-build-dependencies --force-reinstall --verbose
lint_folders = python setup.py sphericart-torch/python sphericart-torch/setup.py sphericart-jax/python sphericart-jax/setup.py
packaging_deps =
wheel
setuptools
cmake
[testenv:tests]
description = "tests for the Python bindings"
deps =
{[testenv]packaging_deps}
numpy
scipy>1.14
pytest
metatensor
commands =
pip install {[testenv]pip_install_flags} .
pytest python {posargs}
[testenv:torch-tests]
description = "tests for the Torch bindings"
deps =
{[testenv]packaging_deps}
numpy
torch
pytest
e3nn
metatensor-torch
changedir = sphericart-torch
commands =
pip install {[testenv]pip_install_flags} .
pytest python {posargs}
[testenv:jax-tests]
description = "tests for the JAX bindings"
deps =
{[testenv]packaging_deps}
pybind11
numpy
absl-py # jax uses this package but not installed by jax[cpu]
pytest
equinox
allowlist_externals =
bash
changedir = sphericart-jax
commands =
# install sphericart for validation of the JAX version
pip install {[testenv]pip_install_flags} ..
# Install this one manually. Listing it in the deps list above does not install jaxlib.
# Note: jax[cuda12] is not available on Windows and MacOS.
bash -c 'command -v nvcc && python -m pip install -U "jax[cuda12]<0.7.2" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html || python -m pip install -U "jax[cpu]<0.7.2"'
pip install {[testenv]pip_install_flags} .
pytest python {posargs}
[testenv:examples]
description = "run examples for all bindings"
deps =
{[testenv]packaging_deps}
pybind11
numpy
torch
pytest
metatensor-torch
commands =
# Install this one manually. Listing it in the deps list above does not install jaxlib.
# Note: jax[cuda12] is not available on Windows and MacOS.
bash -c 'command -v nvcc && python -m pip install -U "jax[cuda12]<0.7.2" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html || python -m pip install -U "jax[cpu]<0.7.2"'
pip install {[testenv]pip_install_flags} .
pip install {[testenv]pip_install_flags} ./sphericart-torch
pip install {[testenv]pip_install_flags} ./sphericart-jax
python examples/python/example.py
python examples/pytorch/example.py
python examples/jax/example.py
python examples/metatensor/example.py
python examples/python/spherical.py
python examples/python/complex.py
python examples/python/spherical_and_complex.py
[testenv:build-python]
description = "make sure the sphericart python package builds correctly"
deps =
build
twine
allowlist_externals =
bash
commands =
# check building sdist from a checkout and wheel from the sdist
python -m build .
twine check dist/*.tar.gz
twine check dist/*.whl
# check building wheels from a checkout
python -m build . --wheel
[testenv:build-torch]
description = "make sure the sphericart-torch python package builds correctly"
deps =
build
twine
changedir = sphericart-torch
commands =
# check building sdist from a checkout and wheel from the sdist
python -m build .
twine check dist/*.tar.gz
twine check dist/*.whl
# check building wheels from a checkout
python -m build . --wheel
[testenv:build-jax]
description = "make sure the sphericart-jax python package builds correctly"
deps =
build
twine
changedir = sphericart-jax
commands =
# check building sdist from a checkout and wheel from the sdist
python -m build .
twine check dist/*.tar.gz
twine check dist/*.whl
# check building wheels from a checkout
python -m build . --wheel
[testenv:lint]
description = "code formatting and linting"
deps =
clang-format
ruff
allowlist_externals = bash
commands =
ruff format --diff {[testenv]lint_folders}
ruff check {[testenv]lint_folders}
bash ./scripts/check-format.sh
[testenv:format]
description = "use tox to format the codebase"
deps =
clang-format
ruff
allowlist_externals = bash
commands =
ruff format {[testenv]lint_folders}
ruff check --fix-only {[testenv]lint_folders}
bash ./scripts/format.sh
[testenv:docs]
description = "build documentation"
deps =
{[testenv]packaging_deps}
pybind11
-r docs/requirements.txt
pybind11
cmake
commands =
pip install {[testenv]pip_install_flags} .
pip install {[testenv]pip_install_flags} ./sphericart-jax
pip install {[testenv]pip_install_flags} ./sphericart-torch
sphinx-build {posargs:-E} -W -b html docs/src docs/build/html
[testenv:docs-tests]
description = "check that the code examples in the docs work"
deps =
pytest
{[testenv]packaging_deps}
numpy
torch
commands =
pip install {[testenv]pip_install_flags} .
pip install {[testenv]pip_install_flags} ./sphericart-torch
pytest --doctest-modules --pyargs sphericart {posargs}
[flake8]
max_line_length = 88
extend-ignore = E203