-
Notifications
You must be signed in to change notification settings - Fork 7
/
tox.ini
172 lines (160 loc) · 4.15 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
[tox]
min_version = 4.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
build
tests
[testenv]
passenv = *
lint_folders =
"{toxinidir}/examples/" \
"{toxinidir}/src/" \
"{toxinidir}/tests/" \
"{toxinidir}/docs/src/"
[testenv:lint]
description = Run linters and type checks
package = skip
deps =
black
blackdoc
flake8
flake8-bugbear
flake8-sphinx-links
mypy
isort
sphinx-lint
commands =
flake8 {[testenv]lint_folders}
black --check --diff {[testenv]lint_folders}
blackdoc --check --diff {[testenv]lint_folders} "{toxinidir}/README.rst"
isort --check-only --diff {[testenv]lint_folders}
mypy {[testenv]lint_folders}
sphinx-lint \
--enable all \
--max-line-length 88 \
-i "{toxinidir}/docs/src/examples" \
{[testenv]lint_folders} "{toxinidir}/README.rst"
[testenv:format]
description = Abuse tox to do actual formatting on all files.
package = skip
deps =
black
blackdoc
isort
commands =
black {[testenv]lint_folders}
blackdoc {[testenv]lint_folders} "{toxinidir}/README.rst"
isort {[testenv]lint_folders}
[testenv:tests]
description = Run basic package tests with pytest (not the architectures)
passenv = *
deps =
pytest
pytest-cov
pytest-xdist
huggingface_hub
spherical # for nanoPET spherical target
changedir = tests
extras = # architectures used in the package tests
soap-bpnn
nanopet
allowlist_externals = bash
commands_pre = bash {toxinidir}/tests/resources/generate-outputs.sh
commands =
pytest \
--numprocesses=auto \
--cov={env_site_packages_dir}/metatrain \
--cov-append \
--cov-report= \
--import-mode=append \
{posargs}
[testenv:build]
description = builds the package and checks integrity
usedevelop = true
deps =
build
check-manifest
twine
allowlist_externals = rm
commands_pre =
rm -f {toxinidir}/dist/*.whl
rm -f {toxinidir}/dist/*.tar.gz
commands =
python -m build
twine check dist/*.tar.gz dist/*.whl
check-manifest {toxinidir}
[testenv:soap-bpnn-tests]
description = Run SOAP-BPNN tests with pytest
passenv = *
deps =
pytest
extras = soap-bpnn
changedir = src/metatrain/experimental/soap_bpnn/tests/
commands =
pytest {posargs}
[testenv:alchemical-model-tests]
description = Run Alchemical Model tests with pytest
passenv = *
deps =
pytest
extras = alchemical-model
changedir = src/metatrain/experimental/alchemical_model/tests/
commands =
; pytest {posargs}
[testenv:pet-tests]
description = Run PET tests with pytest
passenv = *
deps =
pytest
extras = pet
changedir = src/metatrain/experimental/pet/tests/
commands =
python -m pip uninstall -y pet
python -m pip install "pet @ git+https://github.com/lab-cosmo/pet@5d40710" --no-build-isolation
pytest {posargs}
[testenv:gap-tests]
description = Run GAP tests with pytest
passenv = *
deps =
pytest
extras = gap
changedir = src/metatrain/experimental/gap/tests/
commands =
pytest {posargs}
[testenv:nanopet-tests]
description = Run NanoPET tests with pytest
passenv = *
deps =
pytest
spherical # for nanoPET spherical target
extras = nanopet
changedir = src/metatrain/experimental/nanopet/tests/
commands =
pytest {posargs}
[testenv:docs]
description = builds the documentation with sphinx
deps =
-r docs/requirements.txt
allowlist_externals =
bash
extras = # these models are used in the documentation
gap
soap-bpnn
commands_pre =
# Run example and usage scripts.
bash -c "set -e && cd {toxinidir}/examples/basic_usage && bash usage.sh"
bash -c "set -e && cd {toxinidir}/examples/ase && bash train.sh"
bash -c "set -e && cd {toxinidir}/examples/programmatic/llpr && bash train.sh"
bash -c "set -e && cd {toxinidir}/examples/zbl && bash train.sh"
sphinx-build \
{posargs:-E} \
--builder html \
--doctree-dir docs/build/doctree \
--fail-on-warning \
docs/src docs/build/html
[flake8]
# longer lines for compatibility with other linters
max_line_length = 88
extend-ignore = E203