Skip to content

Handling of the Description metadata field #867

@dnicolodi

Description

@dnicolodi

Since metadata version 2.1, the package description can go into the body of the RFC822 metadata serialization format. Before then, it was encoded in the Description header with custom multi-line serialization involving continuation lines to be prefixed with 7 spaces and a |, see https://packaging.python.org/en/latest/specifications/core-metadata/#description

packaging.metadata.RawMetadata and packaging.metadara.Metadata do not interpret the continuation lines prefix, thus consumers of the description fields of these objects need to implement it themselves. This is a bit inconvenient and it may result in different tools interpreting the metadata differently. Would it be desirable to add continuation lines interpretation to packaging.metadata?

One twist on this is that setuptools (at least in version 45.2.0, which is still used in the wild, see pypa/twine#1218) generates continuation lines with the wrong prefix: the | is missing. How would this need to be treated?

The same applies also to the License field which in some projects is used to store the whole text of the license as a multi-line field, although with a different format which does not use the | character. Fixing the leading space there would also be nice. The License field will be slowly be replaced by the License-Expression and License-File field, but parsing metadata from existing distributions still applied, and the tail of packages building with outdated build backends is very long.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions