checks.metadata.MetadataCheck
checks.metadata.MetadataCheck()Check that package metadata is valid and complete.
Validates package metadata according to PEP 621 (pyproject.toml). Checks for required fields (name, version) and recommends additional fields (description, readme, license, requires-python).
Attributes
name :-
The check identifier (“metadata”).
description :-
Human-readable description of this check.
REQUIRED_FIELDS :-
List of fields that must be present in [project].
RECOMMENDED_FIELDS :-
List of fields that should be present.
Examples
Run the metadata check on a package:
>>> from pathlib import Path
>>> check = MetadataCheck()
>>> result = check.run(Path("."), {"enabled": True})
>>> result.status in [CheckStatus.OK, CheckStatus.NOTE, CheckStatus.ERROR]
TrueThe check validates pyproject.toml structure:
>>> check.REQUIRED_FIELDS
['name', 'version']Methods
| Name | Description |
|---|---|
| run | Check package metadata for validity and completeness. |
run
checks.metadata.MetadataCheck.run(package_path, config)Check package metadata for validity and completeness.
Looks for pyproject.toml first (preferred), falling back to setup.py/setup.cfg (legacy). Validates required fields and suggests recommended fields.
Parameters
Returns
: CheckResult-
A CheckResult with:
: CheckResult-
- OK status if all required and recommended fields present
: CheckResult-
- NOTE status if required fields present but some recommended missing
: CheckResult-
- WARNING status if using legacy setup.py/setup.cfg
: CheckResult-
- ERROR status if pyproject.toml is invalid or missing required fields