Skip to content

Commit aa476c3

Browse files
EliahKaganclaude
andcommitted
ci: validate [tool.tox] and other tool tables with SchemaStore schemas
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`. Run through pre-commit, the hook passes on this repository's `pyproject.toml`, so the existing tool tables already match their schemas. In a scratch repository, it fails on a `pyproject.toml` with `skip_install = "yes please"` in a tox environment ("`skip_install` must be boolean") and on one whose `posargs` replacement was misspelled as `replace = "posarg"`. 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>
1 parent c4412ef commit aa476c3

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎.pre-commit-config.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ repos:
3131
rev: v0.25
3232
hooks:
3333
- id: validate-pyproject
34+
# Also validate `[tool.tox]` and other tool tables, with SchemaStore's schemas.
35+
additional_dependencies: ["validate-pyproject-schema-store[all]==2026.10.17"]

0 commit comments

Comments
 (0)