pyproject-metadata
PEP 621 metadata parsing
What it is and what it does
pyproject-metadata is a dataclass-based validator and transformer for Python project metadata. It takes a parsed dictionary representing the [project] table from pyproject.toml, validates it against PEP 621 and related standards, and generates RFC 822-formatted core metadata suitable for distribution (e.g., PKG-INFO files). It does not parse TOML itself—that responsibility stays with the caller—but handles all the structural validation, normalization, and serialization that build backends and packaging tools need.
The package supports modern metadata standards including dynamic metadata (METADATA 2.2+), SPDX license expressions (METADATA 2.4+), and flexible error reporting. It can collect all validation errors at once rather than failing on the first one, making it useful for build systems that want to report comprehensive feedback. It also provides utilities to map between pyproject.toml field names and their corresponding metadata fields, and can validate classifiers against the trove_classifiers library if installed.
Use it for:
- Build backends (like hatchling or flit) validating and serializing project metadata during package builds.
- Packaging tools that need to generate or inspect PKG-INFO files without re-parsing TOML.
- CI/CD pipelines validating pyproject.toml metadata structure before publishing to PyPI.
- Tools that need to convert between pyproject.toml [project] and core metadata formats programmatically.
- Build systems implementing dynamic metadata, where some fields are computed at build time.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Validates and transforms pyproject.toml [project] metadata into PEP 643-compliant core metadata files (PKG-INFO) without parsing the TOML itself.
Yes. This is a foundational tool for Python build backends and packaging infrastructure. It has no security vulnerabilities, minimal dependencies, active maintenance, and a permissive license. Install it if you're building a backend, validating project metadata, or need to generate core metadata files from structured data.
Install
pyproject-metadata on PyPI
pip
pip install pyproject-metadatauv
uv add pyproject-metadatapoetry
poetry add pyproject-metadataInstalling pyproject-metadata
Before you install
Low friction: single runtime dependency (packaging), pure Python wheel, actively maintained with recent release.
License in practice
MIT license permits unrestricted use, modification, and distribution in commercial and private projects.
Quickstart
from pyproject_metadata import StandardMetadata
parsed = {...} # dict from tomli or similar
metadata = StandardMetadata.from_pyproject(parsed)
pkg_info = metadata.as_rfc822()
print(str(pkg_info))
Requires Python 3.8+; input must already be a parsed dict (TOML parsing is caller's responsibility).
Verify before relying
- Whether SPDX license canonicalization (packaging 24.2+) is mandatory or optional for typical use.
- Performance characteristics when processing large or deeply nested metadata structures.
- Compatibility guarantees across future PEP 621 revisions beyond METADATA 2.4.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — packaging |
| Maintenance | actively maintained — 41 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 14,063,548/month — #1,249 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyproject_metadata-0.12.1-py3-none-any.whl
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
pyproject-tomlParses and validates Python project metadata…
permissive · top 15,000 on PyPI
trove-classifiersProvides the canonical set of valid PyPI…
permissive · top 100 on PyPI
validate-pyprojectValidates pyproject.toml files against JSON…
copyleft · top 15,000 on PyPI
pyproject-parserParses and extracts metadata from…
permissive · top 15,000 on PyPI
pkginfo2pkginfo2 reads and parses package metadata from…
permissive · top 15,000 on PyPI
pdm-pep517A PEP 517 build backend that reads PEP 621…
permissive · top 15,000 on PyPI
pdm-backendA PEP 517-compliant build backend that reads…
permissive · top 5,000 on PyPI
sphinx-pyprojectLoads Sphinx documentation configuration from…
permissive · top 15,000 on PyPI
dist-metaParse and create Python distribution metadata…
permissive · top 15,000 on PyPI
pyromaPyroma rates how well a Python project complies…
permissive · top 15,000 on PyPI