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

@ -5,6 +5,7 @@ use anyhow::{Context, Result};
use clap::Parser;
use fs_err as fs;
use distribution_types::IndexUrls;
use platform_host::Platform;
use puffin_build::{SourceBuild, SourceBuildContext};
use puffin_cache::{Cache, CacheArgs};
@ -12,7 +13,6 @@ use puffin_client::RegistryClientBuilder;
use puffin_dispatch::BuildDispatch;
use puffin_interpreter::Virtualenv;
use puffin_traits::{BuildContext, BuildKind};
use pypi_types::IndexUrls;
#[derive(Parser)]
pub(crate) struct BuildArgs {

View file

@ -9,7 +9,9 @@ use itertools::{Either, Itertools};
use rustc_hash::FxHashMap;
use tracing::info;
use distribution_types::{CachedDist, Dist, DistributionMetadata, Name, Resolution, VersionOrUrl};
use distribution_types::{
CachedDist, Dist, DistributionMetadata, IndexUrls, Name, Resolution, VersionOrUrl,
};
use install_wheel_rs::linker::LinkMode;
use pep508_rs::Requirement;
use platform_host::Platform;
@ -23,7 +25,6 @@ use puffin_interpreter::Virtualenv;
use puffin_normalize::PackageName;
use puffin_resolver::DistFinder;
use puffin_traits::{BuildContext, OnceMap};
use pypi_types::IndexUrls;
#[derive(Parser)]
pub(crate) struct InstallManyArgs {

View file

@ -5,20 +5,18 @@ use anstream::println;
use anyhow::{Context, Result};
use chrono::{DateTime, Utc};
use clap::{Parser, ValueEnum};
use fs_err::File;
use itertools::Itertools;
use petgraph::dot::{Config as DotConfig, Dot};
use distribution_types::IndexUrls;
use pep508_rs::Requirement;
use platform_host::Platform;
use puffin_cache::{Cache, CacheArgs};
use puffin_client::RegistryClientBuilder;
use puffin_dispatch::BuildDispatch;
use puffin_interpreter::Virtualenv;
use puffin_resolver::{Manifest, ResolutionOptions, Resolver};
use pypi_types::IndexUrls;
#[derive(ValueEnum, Default, Clone)]
pub(crate) enum ResolveCliFormat {

View file

@ -11,6 +11,7 @@ use tokio::time::Instant;
use tracing::{info, info_span, span, Level, Span};
use tracing_indicatif::span_ext::IndicatifSpanExt;
use distribution_types::IndexUrls;
use pep508_rs::Requirement;
use platform_host::Platform;
use puffin_cache::{Cache, CacheArgs};
@ -19,7 +20,6 @@ use puffin_dispatch::BuildDispatch;
use puffin_interpreter::Virtualenv;
use puffin_normalize::PackageName;
use puffin_traits::BuildContext;
use pypi_types::IndexUrls;
#[derive(Parser)]
pub(crate) struct ResolveManyArgs {