forked from lab-cosmo/mops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
138 lines (113 loc) · 2.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
137
138
[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
python-tests
torch-tests
cxx-tests
torch-cxx-tests
[testenv]
passenv = *
lint_folders = "{toxinidir}/python" "{toxinidir}/setup.py"
[testenv:lint]
# this environement lints the Python code with flake8 (code linter), black (code
# formatter), and isort (sorting of imports)
allowlist_externals =
bash
package = skip
deps =
flake8
flake8-bugbear
black
blackdoc
isort
clang-format
commands =
flake8 {[testenv]lint_folders}
black --check --diff {[testenv]lint_folders}
blackdoc --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
package = skip
deps =
black
blackdoc
isort
clang-format
commands =
isort {[testenv]lint_folders}
black {[testenv]lint_folders}
blackdoc {[testenv]lint_folders}
bash ./scripts/format.sh
[testenv:python-tests]
passenv = *
deps =
pytest
commands =
pytest --import-mode=append {posargs}
[testenv:torch-tests]
passenv = *
deps =
pytest
torch
changedir = python/mops-torch
commands =
pip install .
pytest --import-mode=append --assert=plain {posargs}
[testenv:cxx-tests]
package = skip
passenv = *
deps =
cmake <3.28
cmake-options =
-DCMAKE_BUILD_TYPE=Debug \
-DMOPS_TESTS=ON
commands =
cmake {toxinidir}/mops -B {envdir}/build {[testenv:cxx-tests]cmake-options}
cmake --build {envdir}/build --config Debug
ctest --test-dir {envdir}/build --build-config Debug --output-on-failure
[testenv:torch-cxx-tests]
package = skip
passenv = *
deps =
cmake <3.28
torch
cmake-options =
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_PREFIX_PATH={env_site_packages_dir}/torch/
commands =
cmake {toxinidir}/mops-torch -B {envdir}/build {[testenv:torch-cxx-tests]cmake-options}
cmake --build {envdir}/build --config Debug
[testenv:build-python]
# this environement makes sure one can build sdist and wheels for Python
deps =
setuptools
wheel
cmake <3.28
twine
build
allowlist_externals =
bash
commands =
# check building sdist and wheels from a checkout
python -m build . --outdir dist
python -m build python/mops-torch --outdir dist
twine check dist/*.tar.gz
twine check dist/*.whl
# check building wheels from the sdist
bash -c "python -m pip wheel --verbose dist/mops-*.tar.gz -w dist/test"
[flake8]
# longer lines for compatibility with other linters
max_line_length = 88
# ignore E741: allow single-letter variable names
extend-ignore = E203, E741
[isort]
profile = black