mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 13:25:00 +00:00
Move PyPI-oriented types out of puffin-client
crate (#255)
Just an internal change to avoid a dependency on `puffin-client` for those crates that need access to PyPI-metadata types.
This commit is contained in:
parent
08f09e4743
commit
16aac834ee
13 changed files with 20 additions and 17 deletions
|
@ -11,11 +11,10 @@ use reqwest_retry::RetryTransientMiddleware;
|
|||
use tracing::trace;
|
||||
use url::Url;
|
||||
|
||||
use puffin_package::metadata::Metadata21;
|
||||
use puffin_package::package_name::PackageName;
|
||||
use puffin_package::pypi_types::{File, Metadata21, SimpleJson};
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::types::{File, SimpleJson};
|
||||
|
||||
/// A builder for an [`RegistryClient`].
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use thiserror::Error;
|
||||
use url::Url;
|
||||
|
||||
use puffin_package::metadata;
|
||||
use puffin_package::pypi_types;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
|
@ -18,7 +18,7 @@ pub enum Error {
|
|||
|
||||
/// The metadata file could not be parsed.
|
||||
#[error(transparent)]
|
||||
MetadataParseError(#[from] metadata::Error),
|
||||
MetadataParseError(#[from] pypi_types::Error),
|
||||
|
||||
/// The metadata file was not found in the registry.
|
||||
#[error("File `{0}` was not found in the registry.")]
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
pub use client::{RegistryClient, RegistryClientBuilder};
|
||||
pub use error::Error;
|
||||
pub use types::{File, SimpleJson};
|
||||
|
||||
mod client;
|
||||
mod error;
|
||||
mod types;
|
||||
|
|
|
@ -5,9 +5,9 @@ use anyhow::{anyhow, Result};
|
|||
|
||||
use distribution_filename::WheelFilename;
|
||||
use pep440_rs::Version;
|
||||
use puffin_client::File;
|
||||
use puffin_package::dist_info_name::DistInfoName;
|
||||
use puffin_package::package_name::PackageName;
|
||||
use puffin_package::pypi_types::File;
|
||||
|
||||
/// A built distribution (wheel), which either exists remotely or locally.
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
pub mod dist_info_name;
|
||||
pub mod extra_name;
|
||||
pub mod metadata;
|
||||
pub mod package_name;
|
||||
pub mod pypi_types;
|
||||
pub mod requirements_txt;
|
||||
|
|
|
@ -302,7 +302,7 @@ mod tests {
|
|||
|
||||
use pep508_rs::Requirement;
|
||||
|
||||
use crate::metadata::LenientRequirement;
|
||||
use super::LenientRequirement;
|
||||
|
||||
#[test]
|
||||
fn missing_comma() {
|
5
crates/puffin-package/src/pypi_types/mod.rs
Normal file
5
crates/puffin-package/src/pypi_types/mod.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
pub use metadata::{Error, Metadata21};
|
||||
pub use simple_json::{File, SimpleJson};
|
||||
|
||||
mod metadata;
|
||||
mod simple_json;
|
|
@ -1,6 +1,7 @@
|
|||
use puffin_client::File;
|
||||
use std::ops::Deref;
|
||||
|
||||
use puffin_package::pypi_types::File;
|
||||
|
||||
/// A distribution can either be a wheel or a source distribution.
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct WheelFile(File);
|
||||
|
|
|
@ -9,8 +9,8 @@ use pubgrub::type_aliases::SelectedDependencies;
|
|||
|
||||
use pep440_rs::{Version, VersionSpecifier, VersionSpecifiers};
|
||||
use pep508_rs::{Requirement, VersionOrUrl};
|
||||
use puffin_client::File;
|
||||
use puffin_package::package_name::PackageName;
|
||||
use puffin_package::pypi_types::File;
|
||||
|
||||
use crate::pubgrub::{PubGrubPackage, PubGrubPriority, PubGrubVersion};
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@ use waitmap::WaitMap;
|
|||
use distribution_filename::{SourceDistributionFilename, WheelFilename};
|
||||
use pep508_rs::{MarkerEnvironment, Requirement};
|
||||
use platform_tags::Tags;
|
||||
use puffin_client::{File, RegistryClient, SimpleJson};
|
||||
use puffin_client::RegistryClient;
|
||||
use puffin_package::dist_info_name::DistInfoName;
|
||||
use puffin_package::metadata::Metadata21;
|
||||
use puffin_package::package_name::PackageName;
|
||||
use puffin_package::pypi_types::{File, Metadata21, SimpleJson};
|
||||
use puffin_traits::BuildContext;
|
||||
|
||||
use crate::candidate_selector::CandidateSelector;
|
||||
|
|
|
@ -13,9 +13,9 @@ use zip::ZipArchive;
|
|||
use distribution_filename::WheelFilename;
|
||||
use pep440_rs::Version;
|
||||
use platform_tags::Tags;
|
||||
use puffin_client::{File, RegistryClient};
|
||||
use puffin_package::metadata::Metadata21;
|
||||
use puffin_client::RegistryClient;
|
||||
use puffin_package::package_name::PackageName;
|
||||
use puffin_package::pypi_types::{File, Metadata21};
|
||||
use puffin_traits::BuildContext;
|
||||
|
||||
const BUILT_WHEELS_CACHE: &str = "built-wheels-v0";
|
||||
|
|
|
@ -14,9 +14,9 @@ use tracing::debug;
|
|||
use distribution_filename::WheelFilename;
|
||||
use pep508_rs::Requirement;
|
||||
use platform_tags::Tags;
|
||||
use puffin_client::{File, RegistryClient, SimpleJson};
|
||||
use puffin_package::metadata::Metadata21;
|
||||
use puffin_client::RegistryClient;
|
||||
use puffin_package::package_name::PackageName;
|
||||
use puffin_package::pypi_types::{File, Metadata21, SimpleJson};
|
||||
|
||||
use crate::error::ResolveError;
|
||||
use crate::resolution::{PinnedPackage, Resolution};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue