mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
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:
parent
6ff21374dc
commit
188ab75769
27 changed files with 81 additions and 47 deletions
|
@ -1,10 +1,9 @@
|
|||
use pubgrub::range::Range;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use distribution_types::{Dist, DistributionMetadata, Name};
|
||||
use distribution_types::{Dist, DistributionMetadata, IndexUrl, Name};
|
||||
use pep508_rs::{Requirement, VersionOrUrl};
|
||||
use puffin_normalize::PackageName;
|
||||
use pypi_types::IndexUrl;
|
||||
|
||||
use crate::file::DistFile;
|
||||
use crate::prerelease_mode::PreReleaseStrategy;
|
||||
|
|
|
@ -7,12 +7,11 @@ use rustc_hash::FxHashMap;
|
|||
use thiserror::Error;
|
||||
use url::Url;
|
||||
|
||||
use distribution_types::{BuiltDist, PathBuiltDist, PathSourceDist, SourceDist};
|
||||
use distribution_types::{BuiltDist, IndexUrl, PathBuiltDist, PathSourceDist, SourceDist};
|
||||
use pep508_rs::Requirement;
|
||||
use puffin_distribution::DistributionDatabaseError;
|
||||
use puffin_normalize::PackageName;
|
||||
use puffin_traits::OnceMap;
|
||||
use pypi_types::IndexUrl;
|
||||
|
||||
use crate::pubgrub::{PubGrubPackage, PubGrubReportFormatter, PubGrubVersion};
|
||||
use crate::version_map::VersionMap;
|
||||
|
@ -142,7 +141,7 @@ impl std::fmt::Display for NoSolutionError {
|
|||
impl NoSolutionError {
|
||||
/// Update the available versions attached to the error using the given package version index.
|
||||
///
|
||||
/// Only packages used in the error's deriviation tree will be retrieved.
|
||||
/// Only packages used in the error's derivation tree will be retrieved.
|
||||
pub(crate) fn update_available_versions(
|
||||
mut self,
|
||||
package_versions: &OnceMap<PackageName, (IndexUrl, VersionMap)>,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::ops::Deref;
|
||||
|
||||
use pypi_types::File;
|
||||
use distribution_types::File;
|
||||
|
||||
/// A distribution can either be a wheel or a source distribution.
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
@ -6,14 +6,13 @@ use anyhow::Result;
|
|||
use futures::{stream, Stream, StreamExt, TryStreamExt};
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use distribution_types::{Dist, Resolution};
|
||||
use distribution_types::{Dist, IndexUrl, Resolution};
|
||||
use pep440_rs::Version;
|
||||
use pep508_rs::{Requirement, VersionOrUrl};
|
||||
use platform_tags::{TagPriority, Tags};
|
||||
use puffin_client::{RegistryClient, SimpleMetadata};
|
||||
use puffin_interpreter::Interpreter;
|
||||
use puffin_normalize::PackageName;
|
||||
use pypi_types::IndexUrl;
|
||||
|
||||
use crate::error::ResolveError;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -19,7 +19,8 @@ use url::Url;
|
|||
|
||||
use distribution_filename::WheelFilename;
|
||||
use distribution_types::{
|
||||
BuiltDist, Dist, DistributionMetadata, LocalEditable, Name, PackageId, SourceDist, VersionOrUrl,
|
||||
BuiltDist, Dist, DistributionMetadata, IndexUrl, LocalEditable, Name, PackageId, SourceDist,
|
||||
VersionOrUrl,
|
||||
};
|
||||
use pep508_rs::{MarkerEnvironment, Requirement};
|
||||
use platform_tags::Tags;
|
||||
|
@ -27,7 +28,7 @@ use puffin_client::RegistryClient;
|
|||
use puffin_distribution::{DistributionDatabase, DistributionDatabaseError};
|
||||
use puffin_normalize::PackageName;
|
||||
use puffin_traits::{BuildContext, OnceMap};
|
||||
use pypi_types::{IndexUrl, Metadata21};
|
||||
use pypi_types::Metadata21;
|
||||
|
||||
use crate::candidate_selector::CandidateSelector;
|
||||
use crate::error::ResolveError;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue