skillfed

pyproject-metadata

PEP 621 metadata parsing

pyproject-metadata v0.12.1 14.1M downloads/30d#1,249 on PyPI43
Permissive license MIT Active released

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-metadata

uv

uv add pyproject-metadata

poetry

poetry add pyproject-metadata

Installing 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

Programming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

pyproject.toml metadata validationPEP 621 metadata generationcore metadata PKG-INFOproject metadata dataclassbuild backend metadata handlingRFC 822 metadata formattingdynamic metadata support
build-backendpep-621metadata-validation

More Build Tools packages