-
Notifications
You must be signed in to change notification settings - Fork 14
/
tox.ini
209 lines (164 loc) · 4.92 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
[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
min-deps
all-deps
docs-tests
torch-tests
[testenv]
package = external
package_env = build-featomic
passenv = *
lint-folders = "{toxinidir}/python" "{toxinidir}/setup.py"
# we need to manually install dependencies for featomic, since tox will install
# the fresh wheel with `--no-deps` after building it.
metatensor-core-requirement =
metatensor-core >=0.1.0,<0.2.0
metatensor-torch-requirement =
metatensor-torch >=0.6.0,<0.7.0
build-single-wheel = --no-deps --no-build-isolation --check-build-dependencies
warning_options =
-W "ignore:ast.Str is deprecated and will be removed in Python 3.14:DeprecationWarning" \
-W "ignore:Attribute s is deprecated and will be removed in Python 3.14:DeprecationWarning" \
-W "ignore:ast.NameConstant is deprecated and will be removed in Python 3.14:DeprecationWarning"
# the "-W ignore" flags above are for PyTorch, which triggers a bunch of
# internal warnings with Python 3.12
test_options =
--cov={env_site_packages_dir}/featomic \
--cov-append \
--cov-report= \
--import-mode=append \
{[testenv]warning_options}
packaging_deps =
setuptools
packaging
wheel
cmake
[testenv:build-featomic]
description =
This environment is only used to build the wheels which are then re-used by
all other environments requiring featomic to be installed
passenv = *
deps =
{[testenv]packaging_deps}
{[testenv]metatensor-core-requirement}
commands =
pip wheel python/featomic {[testenv]build-single-wheel} --wheel-dir {envtmpdir}/dist
[testenv:all-deps]
# note: platform_system can be "Linux","Darwin", or "Windows".
description =
Run Python unit tests with all dependencies installed
deps =
{[testenv]metatensor-core-requirement}
ase
chemfiles
metatensor-operations
pytest
pytest-cov
scipy
sympy
torch
pyscf;platform_system!="Windows"
wigners
changedir = python/featomic
commands =
pytest {[testenv]test_options} {posargs}
[testenv:min-deps]
description = Run Python unit tests with the minimal dependencies installed
deps =
{[testenv]metatensor-core-requirement}
pytest
pytest-cov
changedir = python/featomic
commands =
pytest {[testenv]test_options} {posargs}
[testenv:torch-tests]
description = Run Python unit tests using torch
deps =
{[testenv]packaging_deps}
{[testenv]metatensor-torch-requirement}
metatensor-operations
pytest
pytest-cov
numpy
torch
ase
changedir = python/featomic_torch
commands =
# install featomic-torch
pip install . {[testenv]build-single-wheel} --force-reinstall
# run the unit tests
pytest {[testenv]test_options} --assert=plain {posargs}
[testenv:docs]
description = Build the package documentation.
deps =
-r docs/requirements.txt
{[testenv]packaging_deps}
allowlist_externals =
bash
commands =
# install featomic-torch
pip install python/featomic_torch --no-deps --no-build-isolation --force-reinstall
sphinx-build {posargs:-E} -W -b html docs/src docs/build/html
[testenv:docs-tests]
description = Runs the doctests defined in any metatensor package
deps =
{[testenv]metatensor-core-requirement}
ase
pyscf;platform_system!="Windows"
pytest
commands =
pytest --doctest-modules --pyargs featomic
[testenv:lint]
description = Run linters and formatter
package = skip
deps =
ruff
commands =
ruff format --diff {[testenv]lint-folders}
ruff check {[testenv]lint-folders}
[testenv:format]
description = Abuse tox to do actual formatting on all files.
package = skip
deps =
ruff
commands =
ruff format {[testenv]lint-folders}
ruff check --fix-only {[testenv]lint-folders}
[testenv:build-tests]
description = Asserts Pythons package build integrity so one can build sdist and wheels
package = skip
deps =
build
twine # a tool to check sdist and wheels metadata
pip2pi # tool to create PyPI-like package indexes
setuptools
allowlist_externals = bash
commands =
python --version # print the version of python used in this test
bash ./scripts/build-all-wheels.sh {envtmpdir}
twine check {envtmpdir}/dist/*.tar.gz
twine check {envtmpdir}/dist/*.whl
# check building wheels directly from the a checkout
python -m build python/featomic --wheel --outdir {envtmpdir}/dist
python -m build python/featomic_torch --wheel --outdir {envtmpdir}/dist
[flake8]
max_line_length = 88
extend-ignore = E203
[coverage:report]
skip_covered = True
show_missing = True
omit =
tests/.*
examples/.*
[coverage:paths]
featomic =
python/featomic/featomic
.tox/*/lib/python*/site-packages/featomic
featomic_torch =
python/featomic_torch/featomic/torch
.tox/*/lib/python*/site-packages/featomic/torch