-
Notifications
You must be signed in to change notification settings - Fork 39
/
tox.ini
199 lines (183 loc) · 5.33 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
[tox]
minversion = 3.14.0
ignore_basepython_conflict = true
# these are the environments that will run when you
# execute `tox` in the command-line
# bellow you will find explanations for all environments
envlist =
build
docs
lint
test
types
integration
# configures which environments run with each python version
[testenv]
basepython =
{build,test,lint,radon,safety,docs,integration,types}: {env:TOXPYTHON:python3}
passenv = *
[testenv:test]
setenv =
PYTHONPATH={toxinidir}/tests
PYTHONUNBUFFERED=yes
# userdevelop is true because HADDOCK3 is expected to be installed from the
# repository.
usedevelop = true
# installs dependencies we need for testing
# by using tox the developer don't need to manage this dependencies
deps =
-r{toxinidir}/requirements.txt
coverage==7.2.5
pytest==7.3.1
pytest-cov==4.0.0
hypothesis==6.75.1
pytest-mock==3.12.0
fastapi==0.110.1
httpx==0.27.0
mpi4py==3.1.6
# before running the tests erases any prerecord of coverage
commands_pre =
coverage erase
# execute pytest
commands =
python -c "from pdbtools import pdb_fixinsert"
pytest tests/ -x --cov --cov-report=term-missing --cov-append --cov-config=.coveragerc --hypothesis-show-statistics {posargs}
# after executing the pytest assembles the coverage reports
commands_post =
coverage report
coverage html
coverage xml
#===============================================================================
[testenv:integration]
setenv =
PYTHONPATH={toxinidir}/integration_tests
PYTHONUNBUFFERED=yes
usedevelop = true
deps =
-r{toxinidir}/requirements.txt
pytest==7.3.1
pytest-mock==3.12.0
mpi4py==3.1.6
commands =
pytest integration_tests/ -v -x
#===============================================================================
[testenv:lint]
skip_install = true
deps =
flake8==6.0.0
flake8-print==5.0.0
flake8-docstrings==1.7.0
flake8-bugbear==23.3.23
pygments==2.15.1
isort==5.12.0
commands =
flake8 {posargs:src/haddock tests integration_tests setup.py examples/run_tests.py examples/compare_runs.py}
isort --quiet --check-only --diff {posargs:src/haddock tests integration_tests setup.py examples/run_tests.py examples/compare_runs.py}
# asserts package build integrity
[testenv:build]
skip_install = true
# setenv here integrates with commit message in .bumpversion.cfg
# we can tests bump2version with an actual commit
setenv =
COMMIT_MSG = Test commit message
# dependencies needed for code quality checks
# you need to add here any additional dependencies you might need
deps =
setuptools==67.7.2
wheel==0.40.0
twine==4.0.2
docutils==0.19
check-manifest==0.49
readme-renderer==37.3
bump2version==1.0.1
commands_pre = python {toxinidir}/devtools/clean_dist_check.py
commands =
python --version
python setup.py sdist bdist_wheel
twine check dist/*.whl
twine check dist/*.tar.gz
check-manifest {toxinidir}
bump2version --dry-run --verbose --allow-dirty patch
bump2version --dry-run --verbose --allow-dirty minor
bump2version --dry-run --verbose --allow-dirty major
commands_post = python {toxinidir}/devtools/clean_dist_check.py
[testenv:docs]
usedevelop = true
deps =
-r {toxinidir}/requirements.txt
sphinx>=2
sphinx-argparse==0.4.0
sphinx_rtd_theme==2.0.0
CommonMark==0.9.1
mock==5.0.2
myst-parser==1.0.0
commands =
sphinx-apidoc -f -e -o docs/ src/haddock -d 1
sphinx-build {posargs:-E} -b html docs haddock3-docs
#sphinx-build -b linkcheck docs haddock3-docs
# code quality assessment. This is not a check in the CI, serves just
# as info for the developer
[testenv:radon]
skip_install = true
deps = radon
commands =
radon cc -s --total-average --no-assert {posargs:src/haddock}
radon mi -m -s {posargs:src/haddock}
# safety checks
[testenv:safety]
skip_install = true
deps = safety
commands = safety check
# type checks
[testenv:types]
skip_install = true
deps =
mypy==1.2.0
types-PyYAML==6.0.12.9
types-toml==0.10.8.6
commands = mypy {posargs:src} --exclude {posargs:src/fcc} --exclude {posargs:src/fast-rmsdmatrix} --exclude {posargs:src/haddock/modules/_template_cat} --ignore-missing-imports --explicit-package-bases --disallow-incomplete-defs # --check-untyped-defs
# CONFIGURATIONS
# favourite configuration for flake8 styling
# https://flake8.pycqa.org/en/latest/#
[flake8]
max_line_length = 80
hang-closing = true
# TODO: Justify why we are ignoring these errors
ignore =
D105
D412
W293
W503
# TODO: Move these to the files where they are needed
per-file-ignores =
setup.py:E501
src/haddock/clis/cli_dmn.py:T201
src/haddock/clis/cli_score.py:T201
src/haddock/core/typing.py:F401
tests/*.py:D103
tests/test_gear_preprocessing.py:E501,D103,W291
tests/test_module_flexref.py:B017
src/haddock/modules/*/*/__init__.py:D205,D400
exclude =
src/haddock/modules/_template_cat/_template_mod/__init__.py
docstring-convention = numpy
[isort]
line_length = 80
indent = 4
multi_line_output = 8
include_trailing_comma = true
lines_after_imports = 2
sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
known_first_party = haddock
known_third_party =
fcc
gdock
hypothesis
jsonpickle
lightdock
numpy
pytest
pdbtools
yaml
skip =
src/haddock/modules/_template_cat/_template_mod/__init__.py