Skip to content

Add pyproject.toml validation to pre-commit - #16334

Open
AlexWaygood wants to merge 1 commit into
mainfrom
alex/validate-pyproject
Open

Add pyproject.toml validation to pre-commit#16334
AlexWaygood wants to merge 1 commit into
mainfrom
alex/validate-pyproject

Conversation

@AlexWaygood

Copy link
Copy Markdown
Member

Add validate-pyproject to check the contents of pyproject.toml files in addition to the syntax checks provided by check-toml, using the same hook and dependency pins as typing_extensions.

It validates standard project metadata and build-system settings, plus supported tool configuration through bundled SchemaStore schemas. For example, it catches:

  • Invalid project metadata, such as version = 1 instead of a string or a malformed Python version constraint like requires-python = "=>3.10".
  • Incorrect build-system settings, such as requires = "hatchling" instead of a list of requirements.
  • Misspelled tool settings and incorrect value types, such as line-lenght = 130 under [tool.ruff] or preview = "true" instead of a boolean under [tool.black].

Assisted by Codex.

@AlexWaygood
AlexWaygood marked this pull request as ready for review September 1, 2026 11:08
@srittau

srittau commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

I think we're getting in the territory where the potential threat through compromised third-party actions outweighs the usefulness of the the checks. pyproject.toml barely changes, these changes are peer reviewed, and most errors should be spotted pretty quickly because changes have no effect. Overall, I'm -0 on this.

@AlexWaygood

Copy link
Copy Markdown
Member Author

yeah, this one's pretty marginal, I don't feel strongly about this one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants