Preserve compatible metadata versions in convert#690
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #690 +/- ##
==========================================
+ Coverage 55.39% 55.60% +0.20%
==========================================
Files 15 15
Lines 1213 1223 +10
==========================================
+ Hits 672 680 +8
- Misses 541 543 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
So is it that Artifactory still doesn't support metadata 2.4? |
|
All this touches is the metadata version number. Have you checked that the output metadata can still be compatible with all those previous metadata versions? Surely there have been significant changes over time. |
|
I'm only familiar with the 2.1-2.6 range, but generally you do not ever want to auto-update the version if it was produced as an older version. For example, 2.2 make a change that you cannot auto-upgrade: it adds meaning to missing values that wasn't there before. I don't know about the pre-2 to 2 transition though (I think it's less defined, IIRC around 2.1 was the first strongly defined version? Maybe misremembering. I'm sure you could ask an LLM). |
|
From my cursory LLM chat, it seems like keeping the metadata version should be safe, so this PR is fine. |
agronholm
left a comment
There was a problem hiding this comment.
Aside from the questions I asked, this also needs a changelog entry in docs/news.rst.
Summary
Preserve the source metadata version during
wheel convertwhen it is already compatible, instead of always rewriting converted metadata to2.4.Closes #643.
Problem
On current
main,wheel convertrewrites convertedPKG-INFOmetadata toMetadata-Version: 2.4unconditionally.That means converting an egg with
Metadata-Version: 2.1produces a wheel whoseMETADATAadvertises2.4, even when the converted fields only require the older format. The issue report shows that this breaks downstream repositories such as Artifactory instances that still reject metadata newer than2.3.The packaging spec also says build tools may emit the lowest metadata version that supports the fields they write.
Solution
1.2, which is the minimum version needed for the generatedRequires-DistandProject-URLfields1.1 -> 1.2and2.1 -> 2.1Verification
.venv/bin/pytest -q.venv/bin/pytest tests/commands/test_convert.py -q.venv/bin/ruff check src/wheel/_commands/convert.py tests/commands/test_convert.pyPYTHONPATH=src .venv/bin/python - <<'PY' ...probe confirming1.1 -> 1.2and2.1 -> 2.1