pypa / pypa/packaging

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

Open
#862 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement packaging.metadata
Dominant language
Python
Stars
751
Forks
324
Avg merge
12h 58m
Merged PRs (30d)
3

Description

Due to https://github.com/pypa/setuptools/issues/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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin at packaging.metadata.from_raw, where the traceback shows validation rejecting License-File as metadata 2.4 in a 2.1 document. Resolve the compatibility and opt-in behavior described in the issue; done means License-File handling is defined without disabling metadata validation globally.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.