-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtox.ini
249 lines (230 loc) · 8.83 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# This file provides configurations for tox-based project automation tasks. Generally, this project uses tox similar
# to how some other projects use build-systems.
# Base tox configurations. Note, the 'envlist' will run in the listed order whenever 'tox' is used without an -e
# specifier.
[tox]
requires =
tox-uv>=1,<2
tox>=4,<5
envlist =
lint
stubs
{py311, py312, py313}-test
coverage
docs
install
# This forces tox to create a 'sterile' environment into which the project with all dependencies is installed prior to
# running the requested tasks, isolating the process from the rest of the system. This is almost always the desired
# runtime mode.
isolated_build = True
# Note: The 'basepython' argument should either be set to the oldest version in the supported stack or to the main
# version. It controls the specific ruleset used to format and (especially) style-check the code. Also, existing
# stubs prevent mypy from checking source code, so they are removed before linting.
[testenv: lint]
description =
Runs static code formatting, style and typing checkers. Mypy may not work properly until py.typed marker is
added by 'stubs' task.
deps =
mypy>=1,<2
ruff>=0,<1
ataraxis-automation>=4,<5
types-pyyaml>=6,<7
basepython = py311
commands =
automation-cli purge-stubs
ruff check --select I --fix
ruff format
mypy . --strict --extra-checks
# Note: if py.typed is not present, generates the marker in the highest library directory before generating stub files.
# Builds and uses the distribution package to generate the stubs.
[testenv: stubs]
description =
Generates the py.typed marker and the stub files using the built library wheel. Formats the stubs with ruff before
moving them to appropriate source sub-directories.
deps =
mypy>=1,<2
ruff>=0,<1
ataraxis-automation>=4,<5
depends = lint
commands =
automation-cli process-typed-markers
# --no-analysis is currently mandatory to avoid error parsing numpy 2.0.0 calls. Remove once error is fixed. This
# error is on mypy side, not out pipelines --Ivan
stubgen -o stubs --include-private --include-docstrings --no-analysis -p ataraxis_data_structures -v
automation-cli process-stubs
ruff check --select I --fix
ruff format
# Note: The test source code should be written to import and use intended library name, as the project is compiled and
# installed as a library prior to running the tests. Therefore, the tests need to be designed to test the distributed
# library, rather than the source code.
[testenv: {py311, py312, py313}-test]
package = wheel
description =
Runs unit and integration tests for each of the python versions listed in the task name. Uses 'loadgroup' balancing
and all logical cores to optimize runtime speed while allowing manual control over which cores execute tasks (see
pytest-xdist documentation).
deps =
pytest>=8,<9
pytest-cov>=6,<7
pytest-xdist>=3,<4
coverage[toml]>=7,<8
setenv =
# Sets environment parameters, which includes intermediate coverage aggregation file used by coverage.
COVERAGE_FILE = reports{/}.coverage.{envname}
commands =
# Make sure the --cov is always set to the intended library name, so that coverage runs on the whole library
# exactly once.
pytest --import-mode=append --cov=ataraxis_data_structures --cov-config=pyproject.toml --cov-report=xml \
--junitxml=reports/pytest.xml.{envname} -n logical --dist loadgroup
[testenv:coverage]
skip_install = true
description =
Combines test-coverage data from multiple test runs (for different python versions) into a single html file. The
file can be viewed by loading the 'reports/coverage_html/index.html'.
setenv = COVERAGE_FILE = reports/.coverage
depends = {py311, py312, py313}-test
deps =
junitparser>=3,<4
coverage[toml]>=7,<8
commands =
junitparser merge --glob reports/pytest.xml.* reports/pytest.xml
coverage combine
coverage html
# Uses '-j auto' to parallelize the build process and '-v' to make it verbose.
[testenv:docs]
description =
Builds the API documentation from source code docstrings using Sphinx. The result can be viewed by loading
'docs/build/html/index.html'.
deps =
sphinx>=8,<9
importlib_metadata>=8,<9
sphinx-rtd-theme>=3,<4
sphinx-click>=6,<7
sphinx-autodoc-typehints>=2,<3
commands =
sphinx-build -b html -d docs/build/doctrees docs/source docs/build/html -j auto -v
[testenv:build]
skip_install = true
description =
Builds the source code distribution (sdist) and the binary distribution package (wheel). Use 'upload' task to
subsequently upload built wheels to PyPI.
deps =
build>=1,<2
hatchling>=1,<2
allowlist_externals =
docker
commands =
python -m build . --sdist
python -m build . --wheel
# You can pass the '--replace-token' flag from the command line to replace the token stored in the .pypirc file.
[testenv:upload]
skip_install = true
description =
Uses twine to upload all files inside the '/dist' folder to PyPI, ignoring any files that are already uploaded.
Uses API token stored in '.pypirc' file or provided by user to authenticate the upload.
deps =
twine>=5,<6
ataraxis-automation>=4,<5
allowlist_externals =
distutils
commands =
automation-cli acquire-pypi-token {posargs:}
twine upload dist/* --skip-existing --config-file .pypirc
# Note: This task automatically uses the latest version of the package uploaded to PyPI and expects it to contain
# sdist archive. Ideally, it should be used together with the build and twine tasks, as that would ensure the recipe
# always matches the latest distributed code version.
[testenv:recipe]
skip_install = true
description =
Uses grayskull to parse the source code tarball stored on PyPI and generate the recipe used to submit the
package to conda-forge. The submission process has to be carried out manually, see
https://conda-forge.org/docs/maintainer/adding_pkgs/ for more details.
deps =
grayskull>=2,<3
ataraxis-automation>=4,<5
commands =
automation-cli generate-recipe-folder
grayskull pypi ataraxis-data-structures -o recipe --strict-conda-forge --list-missing-deps -m Inkaros
[testenv:install]
skip_install = true
deps =
ataraxis-automation>=4,<5
depends =
lint
stubs
{py311, py312, py313}-test
coverage
docs
description =
Builds and installs the project into the specified conda environment. If the environment does not exist, creates
it before installing the project.
commands =
automation-cli install-project --environment-name axds_dev
[testenv:uninstall]
skip_install = true
deps =
ataraxis-automation>=4,<5
description =
Uninstalls the project from the specified conda environment. If the environment does not exist
this task silently succeeds.
commands =
automation-cli uninstall-project --environment-name axds_dev
[testenv:create]
skip_install = true
deps =
ataraxis-automation>=4,<5
description =
Creates a minimally-configured conda environment using the requested python version and installs conda- and pip-
dependencies extracted from pyproject.toml file into the environment. Does not install the project!
commands =
automation-cli create-env --environment-name axds_dev --python-version 3.13
[testenv:remove]
skip_install = true
deps =
ataraxis-automation>=4,<5
description =
Removes the requested conda environment, if it is installed locally.
commands =
automation-cli remove-env --environment-name axds_dev
[testenv:provision]
skip_install = true
deps =
ataraxis-automation>=4,<5
description =
Provisions an already existing environment by uninstalling all packages from the environment and then installing the
project dependencies using pyproject.toml specifications.
commands =
automation-cli provision-env --environment-name axds_dev --python-version 3.13
[testenv:export]
skip_install = true
deps =
ataraxis-automation>=4,<5
description =
Exports the requested conda environment to the 'envs' folder as a .yml file and as a spec.txt with revision history.
commands =
automation-cli export-env --environment-name axds_dev
[testenv:import]
skip_install = true
deps =
ataraxis-automation>=4,<5
description =
Discovers and imports (installs) a new or updates an already existing environment using the .yml file
stored in the 'envs' directory.
commands =
automation-cli import-env --environment-name axds_dev
[testenv:rename]
skip_install = true
deps =
ataraxis-automation>=4,<5
description =
Replaces the base environment name used by all files inside the 'envs' directory with the user-input name.
commands =
automation-cli rename-environments
[testenv:adopt]
skip_install = true
deps =
ataraxis-automation>=4,<5
description =
Adopts a Sun Lab template-generated project by replacing default placeholders with user-provided information.
commands =
automation-cli adopt-project