dist-meta is a Python library (current version 0.9.0) designed to parse and create Python distribution metadata, primarily interacting with `dist-info/METADATA` files. It provides tools for reading distribution information, entry points, and `RECORD` files. Releases are made irregularly as features are added or issues resolved.
pip install dist-metaVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to parse a Python distribution's metadata string using `dist_meta.metadata.loads`. This is useful for programmatically inspecting package information.
Refer to the official Python packaging specifications for the metadata version you are working with. Validate metadata structure and required fields before parsing.
For string content, use `dist_meta.metadata.loads()`. For file paths or file objects, open the file and pass the content to `loads()` or the file object to `load()` respectively.
Ensure all mandatory fields (e.g., `Metadata-Version`, `Name`, `Version`) are present and correctly formatted in the metadata string or file being parsed.
Use `from dist_meta.metadata import loads` and pass the metadata as a string to the `loads()` function. Alternatively, if you intend to read from a file, open the file and pass the file object to `load()`.