-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtox.ini
238 lines (186 loc) · 5.25 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
[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 =
PIP_EXTRA_INDEX_URL
allowlist_externals =
bash
pip_install_flags = --no-deps --no-cache --no-build-isolation --check-build-dependencies --force-reinstall
lint_folders = python setup.py sphericart-torch/python sphericart-torch/setup.py sphericart-jax/python sphericart-jax/setup.py
[testenv:tests]
# this environement runs Python tests
deps =
wheel
setuptools
cmake
numpy
scipy
pytest
metatensor
commands =
pip install {[testenv]pip_install_flags} .
pytest python
[testenv:torch-tests]
# this environement runs tests for the torch bindings
deps =
wheel
setuptools
cmake
numpy
torch
pytest
e3nn
metatensor-torch
changedir = sphericart-torch
passenv=
PIP_EXTRA_INDEX_URL
commands =
pip install {[testenv]pip_install_flags} .
pytest python
[testenv:jax-tests]
# this environement runs tests for the jax bindings
deps =
wheel
setuptools
cmake
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]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html || python -m pip install -U jax[cpu]'
pip install {[testenv]pip_install_flags} .
pytest python
[testenv:examples]
# this environement runs the examples for Python and Pytorch bindings
deps =
wheel
setuptools
cmake
pybind11
numpy
torch
pytest
metatensor
passenv=
PIP_EXTRA_INDEX_URL
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]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html || python -m pip install -U jax[cpu]'
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]
# this environement makes sure one can build sdist and wheels for Python
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]
# this environement makes sure one can build sdist and wheels for the torch bindings
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]
# this environement makes sure one can build sdist and wheels for the torch bindings
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]
allowlist_externals =
bash
# this environement lints the Python code with flake8 (code linter), black (code
# formatter), and isort (sorting of imports)
deps =
flake8
flake8-bugbear
black
isort
clang-format
commands =
flake8 {[testenv]lint_folders}
black --check --diff {[testenv]lint_folders}
isort --check-only --diff {[testenv]lint_folders}
bash ./scripts/check-format.sh
[testenv:format]
# this environement abuses tox to do actual formatting
#
# Users can run `tox -e format` to run formatting on all files
allowlist_externals =
bash
deps =
black
isort
commands =
black {[testenv]lint_folders}
isort {[testenv]lint_folders}
bash ./scripts/format.sh
[testenv:docs]
# this environement builds the documentation with sphinx
deps =
-r docs/requirements.txt
passenv =
PIP_EXTRA_INDEX_URL
commands =
pip install .[torch,jax]
sphinx-build {posargs:-E} -W -b html docs/src docs/build/html
[testenv:docs-tests]
# test examples in the docs
deps =
pytest
commands =
pip install .[torch]
pytest --doctest-modules --pyargs sphericart
[flake8]
max_line_length = 88
extend-ignore = E203