Repository navigation
Commit 1b69c99
build(tox): move the tox configuration into
The tox configuration was kept in `tox.ini` because the only way tox
could read it from `pyproject.toml` was `legacy_tox_ini`: the same INI
text, stored as one big TOML string. Since tox 4.21.0, tox also reads
native TOML from `[tool.tox]`, with real tables, arrays, and typed
values, and tox's documentation now calls the INI format deprecated.
`requires` already asks for tox 4.22 or later, for `dependency_groups`.
Move every setting into `pyproject.toml` and remove `tox.ini`:
- `[tox]` becomes `[tool.tox]`, `[testenv]` becomes
`[tool.tox.env_run_base]`, and each `[testenv:<name>]` becomes
`[tool.tox.env.<name>]`.
- `env_list` lists each environment by name, since TOML has no brace
expansion. The order is unchanged.
- `[testenv:py{38,39,310}]` becomes three tables with the same
settings. TOML has no generative table names. `env_base` templates
(tox 4.46) would give the environments different names, and the
`base` key works in TOML only since tox 4.39, so plain tables keep
the same environments working on every tox that `requires` allows.
- `{posargs}` and `{posargs:...}` become `replace = "posargs"`
tables, with the `gix` environment's default arguments as `default`.
- Commands become argument lists, so they no longer go through
shell-like splitting. `{env_tmp_dir}` is still substituted inside
strings.
Update the README to say where the configuration now is and which tox
it needs. No other file referred to `tox.ini`.
Checked by comparing `tox config -e ALL` from `tox.ini` and from the new
`pyproject.toml`, with both tox 4.22.0 and 4.67.1. For every
environment, including `gix` and the packaging environments, the only
differences are the names of the base tables and the config file path.
Then, with the new configuration and each of those tox versions, `ruff`,
`format`, `mypy`, `html`, `misc`, and `py39`, which installs and
imports GitPython, ran and passed, and
`tox -e py313 -- --collect-only -q test/test_util.py` passed its
arguments to pytest, which collected 185 tests. `tox config -e gix`
shows the default arguments, and arguments given after `--` replace
them. The `misc` run includes the `check-toml` and `validate-pyproject`
hooks, which pass on the new `pyproject.toml`.
tox older than 4.21 does not read `[tool.tox]`, so it can no longer
see `requires` and provision a newer tox, as it could with `tox.ini`.
In a copy of the project, tox 4.11.3 and 4.20.0 both reported "No
tox.ini or setup.cfg or pyproject.toml found, assuming empty tox.ini",
and `tox -e ruff` failed with "provided environments not found in
configuration file". tox 4.21.0 failed with "TypeError: 'tox>=4.22'
is not of type 'Requirement'". tox 4.21.2 and 4.22.0 ran `ruff` and
passed. Plain `tox`, with no `-e`, is worse: with tox 4.11.3, it ran
an empty default environment and passed. That will be fixed
separately, by giving older tox a `legacy_tox_ini` from which it can
provision a newer tox.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>pyproject.toml
1 parent 4b511bf commit 1b69c99
3 files changed
Lines changed: 113 additions & 79 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
| 235 | + | |
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 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 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
This file was deleted.
0 commit comments