A pre-commit hook for PEP639 compliance in your pyproject.toml
.
Add this to your .pre-commit-config.yaml
- repo: https://github.com/sco1/pre-commit-pep639
rev: v0.2.0
hooks:
- id: check-classifiers
- id: check-glob-resolve
- id: check-glob-syntax
NOTE: Unless otherwise noted, any metadata specification arrangements that are not explicitly supported should pass through without failing the hook. For example, if you have a build tool foo
that specifies its metadata in a [tools.foo]
table, its contents will not be checked.
Check classifiers for license specification. Note that currently only pyproject.toml
is inspected, if present.
Two metadata specification types are currently supported:
- PEP621 compliant: The provided TOML file is assumed to contain a
project
table, which contains a list of PyPI classifiers in theclassifiers
field. - Poetry: The provided TOML file is assumed to contain a
tools.poetry
table, which contains a list of PyPI classifiers in theclassifiers
field.
Check that license-files
glob(s) match file(s) in the repo.
NOTE: Globs are checked relative to pyproject.toml
's parent directory, though in most cases this should be the same as the repository's root.
Check that license-files
glob(s) do not contain syntax errors.
The following syntax issues are currently checked:
- Presence of leading slash character (
\
) in glob - Presence of parent directory indicator (
..
) in glob
Starting with Python 3.11, a best attempt is made to support Python versions until they reach EOL, after which support will be formally dropped by the next minor or major release of this package, whichever arrives first. The status of Python versions can be found here.