Repository navigation
Commit d91f487
ci: validate
Now that the tox configuration is in `pyproject.toml`, a mistake in it
is only found when someone runs tox, which CI does not do. The
`validate-pyproject` hook already checks `pyproject.toml` on pushes to
`main` and on pull requests, through the `lint` workflow's pre-commit
job, and in `tox -e misc`. But besides the standard tables, it checks
only `[tool.setuptools]` and `[tool.distutils]`, for which it has
built-in plugins, so it accepted a `[tool.tox]` table with
`skip_install = "yes please"`.
No published pre-commit hook runs tox itself to check its configuration.
The hooks `tox-dev` publishes (`tox-ini-fmt`, `tox-toml-fmt`,
`pyproject-fmt`, and `xml-fmt`) are formatters.
`validate-pyproject-schema-store`, by henryiii, a maintainer of
`scikit-build-core` and `cibuildwheel`, is a `validate-pyproject` plugin
that carries a versioned copy of SchemaStore's schemas for
`pyproject.toml` tool tables, including `[tool.tox]`.
`validate-pyproject`'s README documents adding it to the existing hook
through `additional_dependencies`, which keeps that hook and its pinned
`rev`.
Add it that way, pinned to `validate-pyproject-schema-store[all]`
2026.10.17. When it was chosen, on 2026-10-25, that was the newest
release older than the 7-day cooldown Dependabot uses for this
repository. Dependabot's `pre-commit` support also updates pinned
Python `additional_dependencies`.
Enable only the `setuptools`, `distutils`, and `tox` plugins. The
package brings schemas for many other tool tables, and some of them,
including Ruff's and mypy's, reject keys they do not list. Checked
against a dated copy, using a newly added Ruff or mypy option would
fail the hook on every pull request until the pin was bumped, although
Ruff and mypy already check their own configuration. pre-commit puts
the file name after the hook's arguments, and `--enable-plugins` takes
several values, so `--` ends the list.
Run through pre-commit, the hook passes on this repository's
`pyproject.toml`. In a scratch repository, it fails on `skip_install =
"yes please"` in a tox environment ("`skip_install` must be boolean"),
on a `posargs` replacement misspelled as `replace = "posarg"`, and on an
unknown key in `[tool.setuptools]`. It passes on an unknown
`[tool.ruff.lint]` table, which fails with every plugin enabled. It does
not catch a misspelled key, such as `skipp_install`, because
SchemaStore's tox schema allows keys it does not list. tox can generate
a strict schema with `tox schema --strict`, which does reject unknown
keys, but no published hook uses it.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>[tool.tox] with SchemaStore's schema1 parent ea2dedb commit d91f487
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
0 commit comments