Skip to content

Thoughts on validating License-File presence in metadata version 2.1? #862

Description

@hauntsaninja

Due to pypa/setuptools#4759 , an extremely large number of wheels fails metadata validation.
In a venv of around 800 packages I had lying around, about 75% of them have metadata that fails validation for this reason.

  |   File ".../python3.11/site-packages/packaging/metadata.py", line 752, in from_raw
  |     raise ExceptionGroup("invalid metadata", exceptions)
  | ExceptionGroup: invalid metadata (1 sub-exception)
  +-+---------------- 1 ----------------
    | packaging.metadata.InvalidMetadata: license-file introduced in metadata version 2.4, not 2.1
    +------------------------------------

It seems like it will take many years for this to be long ago enough that this stops being a regular issue for people who want to parse metadata (the setuptools issue is open; I learnt today that I uploaded a wheel with METADATA that fails validation today).

Given the widespread prevalence, should packaging.metadata have some (kwarg opt-out/in) special handling of License-File presence in metadata version 2.1, beyond just turning validation off entirely?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions