-
-
Notifications
You must be signed in to change notification settings - Fork 430
Expand file tree
/
Copy pathtox.ini
More file actions
174 lines (161 loc) · 4.62 KB
/
tox.ini
File metadata and controls
174 lines (161 loc) · 4.62 KB
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
[tox]
requires =
tox>=4.24.1
tox-uv>=1.23
env_list =
fix
py314-parallel
py313-parallel
py312-parallel
py312-pydantic1-parallel
py312-black{24, 23, 22}-parallel
py312-isort{7, 6, 5}-parallel
py311-parallel
py310-parallel
readme
cli-docs
coverage
pkg_meta
skip_missing_interpreters = true
[testenv]
runner = uv-venv-lock-runner
description = run the unit tests with pytest under {base_python}
package = wheel
wheel_build_env = .pkg
extras =
all
pass_env =
DIFF_AGAINST
HTTP_IGNORE_TLS
PYTEST_*
set_env =
COVERAGE_FILE = {work_dir}/.coverage.{env_name}
UV_CACHE_DIR = {work_dir}{/}uv-cache
commands =
pytest {posargs: \
!parallel: -n0 \
parallel: -n auto \
--color=yes \
-m "not perf" \
--cov {env_site_packages_dir}{/}datamodel_code_generator --cov {tox_root}{/}tests \
--cov-config=pyproject.toml --cov-fail-under=0 --no-cov-on-fail --cov-report term-missing:skip-covered \
--cov-report html:{env_tmp_dir}{/}htmlcov \
--cov-report xml:{env:COVERAGE_XML:{work_dir}{/}coverage.{env_name}.xml} \
--junitxml {work_dir}{/}junit.{env_name}.xml \
tests}
diff-cover --compare-branch {env:DIFF_AGAINST:origin/main} {env:COVERAGE_XML:{work_dir}{/}coverage.{env_name}.xml}
dependency_groups =
test
black24: black24
black23: black23
black22: black22
isort7: isort7
isort6: isort6
isort5: isort5
pydantic1: pydantic1
[testenv:fix]
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
commands =
prek run --all-files --show-diff-on-failure
dependency_groups = fix
[testenv:readme]
description = Check help in readme is up to date
commands =
python scripts/update_command_help_on_markdown.py {posargs:--check}
dependency_groups =
no_default_groups = true
[testenv:cli-docs]
description = Build CLI documentation (use --check to validate only)
commands =
pytest --collect-cli-docs -p no:xdist -q
python scripts/build_cli_docs.py {posargs}
dependency_groups = test
no_default_groups = true
[testenv:coverage]
description = combine coverage files and generate diff (against DIFF_AGAINST defaulting to origin/main)
skip_install = true
extras =
parallel_show_output = true
pass_env =
DIFF_AGAINST
set_env =
COVERAGE_FILE = {work_dir}/.coverage
commands =
coverage combine
coverage xml -o {work_dir}/coverage.xml
coverage html -d {work_dir}/htmlcov
diff-cover --compare-branch {env:DIFF_AGAINST:origin/main} {work_dir}/coverage.xml
coverage report --fail-under=100 --skip-covered --show-missing
depends =
py314-parallel
py313-parallel
py312-parallel
py312-pydantic1-parallel
py312-black{24, 23, 22}-parallel
py312-isort{7, 6, 5}-parallel
py311-parallel
py310-parallel
dependency_groups = coverage
[testenv:pkg_meta]
description = check that the long description is valid
skip_install = true
commands =
uv build --sdist --wheel --out-dir {env_tmp_dir} .
twine check {env_tmp_dir}{/}*
check-wheel-contents --no-config {env_tmp_dir}
dependency_groups = pkg-meta
[testenv:llms-txt]
description = Generate llms.txt files (use --check to validate only, requires Python 3.11+)
commands =
python scripts/build_llms_txt.py {posargs}
dependency_groups =
no_default_groups = true
[testenv:config-types]
description = Generate TypedDict files from config models (use --check to validate only)
commands =
datamodel-codegen --profile generate-config-dict {posargs}
datamodel-codegen --profile parser-config-dicts {posargs}
datamodel-codegen --profile parse-config-dict {posargs}
dependency_groups = dev
no_default_groups = true
[testenv:type]
description = run type check on code base
commands =
ty check src
dependency_groups = type
[testenv:docs]
description = generate documentation
extras =
commands =
zensical build
python -c 'print("Documentation generated at file://{tox_root}{/}site{/}index.html")'
dependency_groups = docs
[testenv:dev]
description = generate a DEV environment
package = editable
extras =
all
commands =
uv pip tree
python -c 'import sys; print(sys.executable)'
dependency_groups = dev
[testenv:lock]
runner = uv-venv-runner
description = refresh requirement files
skip_install = true
commands =
uv lock --refresh --upgrade
dependency_groups =
[testenv:perf]
description = run performance benchmarks with codspeed (Python 3.14, Unix only)
base_python = python3.14
commands =
pytest {posargs: \
-n auto \
--color=yes \
--codspeed \
tests/main/test_performance.py}
dependency_groups =
test
benchmark
platform = linux|darwin