You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Validate the metadata using our custom rules, which we layer ontop of the
# built in rules to add PyPI specific constraints above and beyond what the
# core metadata requirements are.
_validate_metadata(metadata, backfill=backfill)
packaging does not support metadata version 2.0, which technically does not exist as a standard. Therefore trying to parse metadata version 2.0 results in an exception being raised:
Apparently, supporting metadata version 2.0 is not necessary anymore, otherwise AFAIK if someone would have tried to upload to PyPI a package using metadata 2.0, they would have encountered an error. However, if it is decided to keep metadata 2.0 support, monkeypatching packaging may be the easiest way forward. This seems to work:
Indeed, looks like we have inadvertently dropped support for Metadata 2.0:
SELECT
FORMAT_DATE('%Y-%m', upload_time) AS upload_month,
count(*) AS count
FROM`bigquery-public-data.pypi.distribution_metadata`WHERE metadata_version ='2.0'ANDDATE(upload_time) >= DATE_SUB(CURRENT_DATE(), INTERVAL 24 MONTH)
GROUP BY1ORDER BY1
upload_month
count
2022-11
23
2022-12
266
2023-01
132
2023-02
106
2023-03
159
2023-04
219
2023-05
174
2023-06
157
2023-07
95
2023-08
196
2023-09
115
2023-10
143
2023-11
182
2023-12
61
2024-01
177
2024-02
51
2024-03
75
(note, nothing after March 2024 which correlates with #15631)
I think, given the low historic counts here & lack of outcry from users, we can just consider this deprecated and drop it from SUPPORTED_METADATA_VERSIONS rather than special-case it.
dnicolodi
added a commit
to dnicolodi/warehouse
that referenced
this issue
Nov 25, 2024
The metadata version is first validated by `packaging` and then by the
additional validation code in warehouse.forklift.metadata. Therefore,
only metadata versions supported by `packaging` can be supported.
Metadata version 2.0 has never officially been codified. `packaging`
does not accept 2.0 as a valid metadata version. To avoid confusion,
remove 2.0 from the list of supported metadata versions.
While at it, describe this fact in a comment, and add an assert.
Fixespypi#17168.
I was reading the code in
warehouse.forklift.metadata
and I found that it tries to support metadata version 2.0:warehouse/warehouse/forklift/metadata.py
Line 35 in 49d17ee
warehouse/warehouse/forklift/metadata.py
Lines 73 to 86 in 49d17ee
However this additional validation function is called the metadata validation in the metadata parser in
packaging
has already been done:warehouse/warehouse/forklift/metadata.py
Lines 65 to 68 in 49d17ee
packaging
does not support metadata version 2.0, which technically does not exist as a standard. Therefore trying to parse metadata version 2.0 results in an exception being raised:Apparently, supporting metadata version 2.0 is not necessary anymore, otherwise AFAIK if someone would have tried to upload to PyPI a package using metadata 2.0, they would have encountered an error. However, if it is decided to keep metadata 2.0 support, monkeypatching
packaging
may be the easiest way forward. This seems to work:but I haven't verified that this approach works as intended in all aspects.
The text was updated successfully, but these errors were encountered: