-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmise.toml
More file actions
259 lines (217 loc) · 8.01 KB
/
mise.toml
File metadata and controls
259 lines (217 loc) · 8.01 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
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
250
251
252
253
254
255
256
257
258
259
[env]
PROJECT_NAME = "strawchemy"
_.python.venv = { path = ".venv" }
_.file = ".env"
[tools]
uv = "latest"
jq = "latest"
pre-commit = "latest"
actionlint = "latest"
python = "{{ get_env(name='PYTHON_VERSION', default='3.13') }}"
[vars]
local_pytest_options = "-n=6 -vv"
pytest_coverage_options = "--cov-config=./pyproject.toml --cov=src --cov-report=html"
ci_pytest_coverage_options = "--cov-config=./pyproject.toml --cov=src --junit-xml=./junit.xml -o junit_family=legacy"
cleanable_paths = '''{{
[
".nox",
".pytest_cache",
".ruff_cache",
".hypothesis",
"build/",
"dist/",
".eggs/",
".coverage",
"coverage.xml",
"coverage.json",
"junit*.xml",
"htmlcov/",
"tests/.pytest_cache",
"tests/**/.pytest_cache",
".mypy_cache",
".unasyncd_cache/",
".auto_pytabs_cache",
"node_module",
] | join(sep=" ")
}}'''
# ###############
# Dependencies
# ###############
[tasks."uv:install"]
description = "Install dependencies"
run = "uv sync --all-extras --dev"
[tasks.install]
description = "Install dependencies and pre-commit hooks"
alias = "i"
depends = ["install:pre-commit", "uv:install"]
[tasks."install:pre-commit"]
description = "Install pre-commit hooks"
run = "pre-commit install --install-hooks 2>&1"
# ###############
# Test
# ###############
[tasks.test]
description = "Run tests"
depends = "uv:install"
alias = "t"
usage = 'arg "<test>" default=""'
run = 'uv run pytest {{vars.local_pytest_options}} {{arg(name="test", var=true, default="")}}'
[tasks."test:coverage"]
description = "Run tests with coverage"
depends = "uv:install"
alias = "tc"
usage = 'arg "<test>" default=""'
run = 'uv run pytest {{vars.local_pytest_options}} {{vars.pytest_coverage_options}} {{arg(name="test", var=true, default="")}}'
[tasks."test:unit"]
description = "Run unit tests"
depends = "uv:install"
alias = "tu"
usage = 'arg "<test>" default=""'
run = 'uv run nox -r -P {{option(name="python", default="3.13")}} -t unit -- tests/unit {{vars.local_pytest_options}} {{arg(name="test", var=true, default="")}}'
[tasks."test:unit:no-extras"]
description = "Run unit tests without extras dependencies"
depends = "uv:install"
alias = "tug"
run = 'uv run nox -r -P {{option(name="python", default="3.13")}} -s unit-no-extras -- tests/unit {{vars.local_pytest_options}} {{arg(name="test", var=true, default="")}}'
[tasks."test:unit:coverage"]
description = "Run unit tests with coverage"
depends = "uv:install"
alias = "tuc"
usage = 'arg "<test>" default=""'
run = 'uv run nox -r -P {{option(name="python", default="3.13")}} -t unit -- tests/unit {{vars.local_pytest_options}} {{vars.pytest_coverage_options}} {{arg(name="test", var=true, default="")}}'
[tasks."test:integration"]
description = "Run integration tests"
depends = "uv:install"
alias = "ti"
run = 'uv run nox -r -P {{option(name="python", default="3.13")}} -s integration -- {{vars.local_pytest_options}} {{arg(name="test", var=true, default="")}}'
[tasks."test:integration-postgres"]
description = "Run integration tests"
depends = "uv:install"
alias = "ti-postgres"
run = 'uv run nox -r -P {{option(name="python", default="3.13")}} -t postgres -- {{vars.local_pytest_options}} {{arg(name="test", var=true, default="")}}'
[tasks."test:integration-mysql"]
description = "Run integration tests"
depends = "uv:install"
alias = "ti-mysql"
run = 'uv run nox -r -P {{option(name="python", default="3.13")}} -t mysql -- {{vars.local_pytest_options}} {{arg(name="test", var=true, default="")}}'
[tasks."test:integration-sqlite"]
description = "Run integration tests"
depends = "uv:install"
alias = "ti-sqlite"
run = 'uv run nox -r -P {{option(name="python", default="3.13")}} -t sqlite -- {{vars.local_pytest_options}} {{arg(name="test", var=true, default="")}}'
[tasks."test:integration:coverage"]
description = "Run integration tests with coverage"
depends = "uv:install"
alias = "tic"
usage = 'arg "<test>" default=""'
run = 'uv run nox -r -P {{option(name="python", default="3.13")}} -s integration -- {{vars.local_pytest_options}} {{vars.pytest_coverage_options}} {{arg(name="test", var=true, default="")}}'
[tasks."test:unit-all"]
description = "Run unit tests on all supported python versions"
depends = "uv:install"
alias = "tua"
usage = 'arg "<test>" default=""'
run = 'uv run nox -r -P {{option(name="python", default="3.13")}} -t unit -- {{vars.local_pytest_options}} {{arg(name="test", var=true, default="")}}'
[tasks."test:integration-all"]
description = "Run integration tests on all supported python versions"
depends = "uv:install"
alias = "tia"
usage = 'arg "<test>" default=""'
run = 'uv run nox -r -P {{option(name="python", default="3.13")}} -s integration -- {{vars.local_pytest_options}} {{arg(name="test", var=true, default="")}}'
[tasks."test:update-snapshots"]
description = "Run snapshot-based tests and update snapshots"
depends = "uv:install"
run = "uv run pytest {{vars.local_pytest_options}} -m snapshot --snapshot-update"
# ###############
# CI
# ###############
[tasks."ci:install"]
description = "Install dependencies and pre-commit hooks"
run = "uv venv --allow-existing && uv pip install nox nox-uv"
[tasks."ci:test"]
description = "Run tests in CI"
usage = 'arg "<session>"'
depends = "ci:install"
env = { UV_PYTHON_PREFERENCE = "only-managed" }
run = "uv run nox -t tests -s '{{arg(name='session')}}' -- -n=2 {{vars.ci_pytest_coverage_options}}"
[tasks."ci:lint"]
description = "Lint CI yaml files"
run = "actionlint -shellcheck ''"
[tasks."ci:test-matrix"]
description = "Output test matrix for CI"
depends = "ci:install"
run = '''
uv run nox --json -t tests -t ci -l |
jq 'map(
{
session,
tags,
python,
name,
job_name: "\( .name ) on \( .python )\( if .call_spec != {} then " (\(.call_spec | to_entries | map("\(.key)=\(.value)") | join(", ")))" else "" end )"
}
)'
'''
[tasks."ci:test-sessions"]
description = "Output test session names for CI"
depends = "ci:install"
run = "uv run nox --json -t tests -l | jq 'map(.name) | unique'"
# ###############
# Linting
# ###############
[tasks."ruff:check"]
description = "Check ruff formatting"
run = "uv run ruff check"
[tasks."ruff:fix"]
description = "Fix ruff errors"
run = "uv run ruff check --fix --unsafe-fixes"
[tasks."ruff:format"]
description = "Format code"
run = "uv run ruff format"
[tasks."ruff:format:check"]
description = "Format code"
run = "uv run ruff format --check"
[tasks.pyright]
description = "Run basedpyright"
run = "uv run basedpyright"
[tasks.vulture]
description = "Run vulture"
run = "uv run --only-group lint vulture"
[tasks.lint]
description = "Lint the code"
alias = "l"
depends = ["vulture", "pyright", "ruff:check", "ruff:format:check", "slotscheck"]
[tasks."lint:pre-commit"]
description = "Lint the code in pre-commit hook"
depends = ["vulture", "pyright"]
[tasks.pre-commit]
description = "Run pre-commit checks"
depends = "install:pre-commit"
run = "pre-commit run --color=always --all-files"
[tasks.slotscheck]
description = "Run slotscheck"
run = "uv run slotscheck src/strawchemy"
# ###############
# Tools
# ###############
[tasks.auto-bump]
description = "Auto bump the version"
confirm = "Are you sure you want to auto bump the version?"
depends = "uv:install"
run = "uv run bump-my-version bump --new-version $(uv run git cliff --unreleased --bumped-version)"
[tasks.clean]
description = "Clean working directory"
alias = "c"
confirm = "Are you sure you want to clean the working directory? This will remove test caches, build artifacts, and other temporary files."
run = [
"rm -rf {{vars.cleanable_paths}} >/dev/null 2>&1",
"find . -name '*.egg-info' -exec rm -rf {} + >/dev/null 2>&1",
"find . -type f -name '*.egg' -exec rm -f {} + >/dev/null 2>&1",
"find . -name '*.pyc' -exec rm -f {} + >/dev/null 2>&1",
"find . -name '*.pyo' -exec rm -f {} + >/dev/null 2>&1",
"find . -name '*~' -exec rm -f {} + >/dev/null 2>&1",
"find . -name '__pycache__' -exec rm -rf {} + >/dev/null 2>&1",
"find . -name '.ipynb_checkpoints' -exec rm -rf {} + >/dev/null 2>&1",
]
[tasks."render:usage"]
description = "Generate tasks documentation"
run = ["mise generate task-docs > tasks.md"]