Split File into internal and external type (#729)

## Summary

This PR makes the `pypi_types::File` a response-only type (i.e., a type
that's only used when deserializing over the wire), and adds a separate
internal `File` type. Right now, the representations are similar, but
already, we can avoid the "lenient" deserialization on our internal
`File` type, and avoid the special-casing of the property names that's
required in the JSON. Over time, we can evolve this representation
entirely separately from the representation we receive from PyPI and
other indexes.
This commit is contained in:
Charlie Marsh 2023-12-25 15:42:28 -05:00 committed by GitHub
parent 6ff21374dc
commit 188ab75769
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 81 additions and 47 deletions

View file

@ -1,8 +1,10 @@
use crate::candidate_selector::Candidate;
use puffin_normalize::PackageName;
use pypi_types::{File, IndexUrl};
use rustc_hash::FxHashMap;
use distribution_types::{File, IndexUrl};
use puffin_normalize::PackageName;
use crate::candidate_selector::Candidate;
/// A set of package versions pinned to specific files.
///
/// For example, given `Flask==3.0.0`, the [`FilePins`] would contain a mapping from `Flask` to