forked from metatensor/metatrain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtox.ini
136 lines (126 loc) · 3.86 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
[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/"
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
[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 src/metatensor
sphinx-lint --enable line-too-long --max-line-length 88 \
-i {[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
changedir = tests
extras = soap-bpnn # this model is used in the package tests
allowlist_externals = bash
commands_pre = bash {toxinidir}/tests/resources/generate-outputs.sh
commands =
pytest \
--cov={env_site_packages_dir}/metatensor --cov-append --cov-report= --import-mode=append \
{[testenv]warning_options} \
{posargs}
[testenv:build]
description = builds the package and checks integrity
usedevelop = true
deps =
build
check-manifest
twine
allowlist_externals = bash
commands_pre =
bash -c "if [ -e {toxinidir}/dist/*tar.gz ]; then unlink {toxinidir}/dist/*.whl; fi"
bash -c "if [ -e {toxinidir}/dist/*tar.gz ]; then unlink {toxinidir}/dist/*.tar.gz; fi"
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/metatensor/models/experimental/soap_bpnn/tests/
commands =
pytest {[testenv]warning_options} {posargs}
[testenv:alchemical-model-tests]
description = Run Alchemical Model tests with pytest
passenv = *
deps =
pytest
extras = alchemical-model
changedir = src/metatensor/models/experimental/alchemical_model/tests/
commands =
pytest {[testenv]warning_options} {posargs}
[testenv:pet-tests]
description = Run PET tests with pytest
passenv = *
deps =
pytest
extras = pet
changedir = src/metatensor/models/experimental/pet/tests/
commands =
pytest {[testenv]warning_options} {posargs}
[testenv:docs]
description = builds the documentation with sphinx
deps =
-r docs/requirements.txt
allowlist_externals =
bash
extras = soap-bpnn # this model is used in the documentation
commands =
# Run .sh scripts in the example folder.
#bash -c "set -e && cd {toxinidir}/examples/basic_usage && bash usage.sh"
# Disable slow training at runtime for ase example to speed up CI for now.
#bash -c "set -e && cd {toxinidir}/examples/ase && bash train_export.sh"
sphinx-build {posargs:-E} -W -b html docs/src docs/build/html
[flake8]
# longer lines for compatibility with other linters
max_line_length = 88
extend-ignore = E203