mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Add PEP 714 support for JSON API client (#3698)
## Summary Closes https://github.com/astral-sh/uv/issues/3689. ## Test Plan Manually verified we pick up `core-metadata` from PyPI if I remove the aliases.
This commit is contained in:
parent
95af1db0bb
commit
5205165d42
3 changed files with 44 additions and 7 deletions
|
@ -37,14 +37,17 @@ fn sorted_simple_json_files<'de, D: Deserializer<'de>>(d: D) -> Result<Vec<File>
|
|||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub struct File {
|
||||
// Non-PEP 691-compliant alias used by PyPI.
|
||||
#[serde(alias = "data-dist-info-metadata")]
|
||||
// PEP 714-renamed field, followed by PEP 691-compliant field, followed by non-PEP 691-compliant
|
||||
// alias used by PyPI.
|
||||
pub core_metadata: Option<DistInfoMetadata>,
|
||||
pub dist_info_metadata: Option<DistInfoMetadata>,
|
||||
pub data_dist_info_metadata: Option<DistInfoMetadata>,
|
||||
pub filename: String,
|
||||
pub hashes: Hashes,
|
||||
/// There are a number of invalid specifiers on pypi, so we first try to parse it into a [`VersionSpecifiers`]
|
||||
/// according to spec (PEP 440), then a [`LenientVersionSpecifiers`] with fixup for some common problems and if this
|
||||
/// still fails, we skip the file when creating a version map.
|
||||
/// There are a number of invalid specifiers on PyPI, so we first try to parse it into a
|
||||
/// [`VersionSpecifiers`] according to spec (PEP 440), then a [`LenientVersionSpecifiers`] with
|
||||
/// fixup for some common problems and if this still fails, we skip the file when creating a
|
||||
/// version map.
|
||||
#[serde(default, deserialize_with = "deserialize_version_specifiers_lenient")]
|
||||
pub requires_python: Option<Result<VersionSpecifiers, VersionSpecifiersParseError>>,
|
||||
pub size: Option<u64>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue