Add uv- prefix to all internal crates (#7853)

## Summary

Brings more consistency to the repo and ensures that all crates
automatically show up in `--verbose` logging.
This commit is contained in:
Charlie Marsh 2024-10-01 20:15:32 -04:00 committed by GitHub
parent 7b55e97909
commit 14507a1793
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
319 changed files with 1327 additions and 1317 deletions

View file

@ -1692,7 +1692,7 @@ jobs:
cargo run --bin uv -- pip compile scripts/requirements/airflow.in --universal --exclude-newer 2024-08-08 --cache-dir .cache cargo run --bin uv -- pip compile scripts/requirements/airflow.in --universal --exclude-newer 2024-08-08 --cache-dir .cache
- name: "Build benchmarks" - name: "Build benchmarks"
run: cargo codspeed build --profile profiling --features codspeed -p bench run: cargo codspeed build --profile profiling --features codspeed -p uv-bench
- name: "Run benchmarks" - name: "Run benchmarks"
uses: CodSpeedHQ/action@v3 uses: CodSpeedHQ/action@v3

666
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -21,38 +21,38 @@ authors = ["uv"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
[workspace.dependencies] [workspace.dependencies]
cache-key = { path = "crates/cache-key" }
distribution-filename = { path = "crates/distribution-filename" }
distribution-types = { path = "crates/distribution-types" }
install-wheel-rs = { path = "crates/install-wheel-rs", default-features = false }
once-map = { path = "crates/once-map" }
pep440_rs = { path = "crates/pep440-rs" }
pep508_rs = { path = "crates/pep508-rs", features = ["non-pep508-extensions"] }
platform-tags = { path = "crates/platform-tags" }
pypi-types = { path = "crates/pypi-types" }
requirements-txt = { path = "crates/requirements-txt" }
uv-auth = { path = "crates/uv-auth" } uv-auth = { path = "crates/uv-auth" }
uv-build-frontend = { path = "crates/uv-build-frontend" } uv-build-frontend = { path = "crates/uv-build-frontend" }
uv-cache = { path = "crates/uv-cache" } uv-cache = { path = "crates/uv-cache" }
uv-cache-info = { path = "crates/uv-cache-info" } uv-cache-info = { path = "crates/uv-cache-info" }
uv-cache-key = { path = "crates/uv-cache-key" }
uv-cli = { path = "crates/uv-cli" } uv-cli = { path = "crates/uv-cli" }
uv-client = { path = "crates/uv-client" } uv-client = { path = "crates/uv-client" }
uv-configuration = { path = "crates/uv-configuration" } uv-configuration = { path = "crates/uv-configuration" }
uv-console = { path = "crates/uv-console" } uv-console = { path = "crates/uv-console" }
uv-dispatch = { path = "crates/uv-dispatch" } uv-dispatch = { path = "crates/uv-dispatch" }
uv-distribution = { path = "crates/uv-distribution" } uv-distribution = { path = "crates/uv-distribution" }
uv-distribution-filename = { path = "crates/uv-distribution-filename" }
uv-distribution-types = { path = "crates/uv-distribution-types" }
uv-extract = { path = "crates/uv-extract" } uv-extract = { path = "crates/uv-extract" }
uv-fs = { path = "crates/uv-fs" } uv-fs = { path = "crates/uv-fs" }
uv-git = { path = "crates/uv-git" } uv-git = { path = "crates/uv-git" }
uv-install-wheel = { path = "crates/uv-install-wheel", default-features = false }
uv-installer = { path = "crates/uv-installer" } uv-installer = { path = "crates/uv-installer" }
uv-macros = { path = "crates/uv-macros" } uv-macros = { path = "crates/uv-macros" }
uv-metadata = { path = "crates/uv-metadata" } uv-metadata = { path = "crates/uv-metadata" }
uv-normalize = { path = "crates/uv-normalize" } uv-normalize = { path = "crates/uv-normalize" }
uv-once-map = { path = "crates/uv-once-map" }
uv-options-metadata = { path = "crates/uv-options-metadata" } uv-options-metadata = { path = "crates/uv-options-metadata" }
uv-pep440 = { path = "crates/uv-pep440" }
uv-pep508 = { path = "crates/uv-pep508", features = ["non-pep508-extensions"] }
uv-platform-tags = { path = "crates/uv-platform-tags" }
uv-pubgrub = { path = "crates/uv-pubgrub" } uv-pubgrub = { path = "crates/uv-pubgrub" }
uv-publish = { path = "crates/uv-publish" } uv-publish = { path = "crates/uv-publish" }
uv-pypi-types = { path = "crates/uv-pypi-types" }
uv-python = { path = "crates/uv-python" } uv-python = { path = "crates/uv-python" }
uv-requirements = { path = "crates/uv-requirements" } uv-requirements = { path = "crates/uv-requirements" }
uv-requirements-txt = { path = "crates/uv-requirements-txt" }
uv-resolver = { path = "crates/uv-resolver" } uv-resolver = { path = "crates/uv-resolver" }
uv-scripts = { path = "crates/uv-scripts" } uv-scripts = { path = "crates/uv-scripts" }
uv-settings = { path = "crates/uv-settings" } uv-settings = { path = "crates/uv-settings" }
@ -178,9 +178,6 @@ zip = { version = "0.6.6", default-features = false, features = ["deflate"] }
ignored = ["flate2", "xz2"] ignored = ["flate2", "xz2"]
[patch.crates-io] [patch.crates-io]
# For pyproject-toml
pep440_rs = { path = "crates/pep440-rs" }
pep508_rs = { path = "crates/pep508-rs" }
reqwest-middleware = { git = "https://github.com/astral-sh/reqwest-middleware", rev = "5e3eaf254b5bd481c75d2710eed055f95b756913" } reqwest-middleware = { git = "https://github.com/astral-sh/reqwest-middleware", rev = "5e3eaf254b5bd481c75d2710eed055f95b756913" }
[workspace.lints.rust] [workspace.lints.rust]

View file

@ -7,12 +7,13 @@ edition = "2021"
workspace = true workspace = true
[dependencies] [dependencies]
uv-once-map = { workspace = true }
anyhow = { workspace = true } anyhow = { workspace = true }
async-trait = { workspace = true } async-trait = { workspace = true }
base64 = { workspace = true } base64 = { workspace = true }
futures = { workspace = true } futures = { workspace = true }
http = { workspace = true } http = { workspace = true }
once-map = { workspace = true }
reqwest = { workspace = true } reqwest = { workspace = true }
reqwest-middleware = { workspace = true } reqwest-middleware = { workspace = true }
rust-netrc = { workspace = true } rust-netrc = { workspace = true }

View file

@ -6,7 +6,7 @@ use rustc_hash::{FxHashMap, FxHasher};
use tracing::trace; use tracing::trace;
use url::Url; use url::Url;
use once_map::OnceMap; use uv_once_map::OnceMap;
use crate::credentials::{Credentials, Username}; use crate::credentials::{Credentials, Username};
use crate::Realm; use crate::Realm;

View file

@ -1,5 +1,5 @@
[package] [package]
name = "bench" name = "uv-bench"
version = "0.0.0" version = "0.0.0"
description = "uv Micro-benchmarks" description = "uv Micro-benchmarks"
publish = false publish = false
@ -28,19 +28,19 @@ path = "benches/uv.rs"
harness = false harness = false
[dependencies] [dependencies]
distribution-filename = { workspace = true }
distribution-types = { workspace = true }
install-wheel-rs = { workspace = true }
pep440_rs = { workspace = true }
pep508_rs = { workspace = true }
platform-tags = { workspace = true }
pypi-types = { workspace = true }
uv-cache = { workspace = true } uv-cache = { workspace = true }
uv-client = { workspace = true } uv-client = { workspace = true }
uv-configuration = { workspace = true } uv-configuration = { workspace = true }
uv-dispatch = { workspace = true } uv-dispatch = { workspace = true }
uv-distribution = { workspace = true } uv-distribution = { workspace = true }
uv-distribution-filename = { workspace = true }
uv-distribution-types = { workspace = true }
uv-git = { workspace = true } uv-git = { workspace = true }
uv-install-wheel = { workspace = true }
uv-pep440 = { workspace = true }
uv-pep508 = { workspace = true }
uv-platform-tags = { workspace = true }
uv-pypi-types = { workspace = true }
uv-python = { workspace = true } uv-python = { workspace = true }
uv-resolver = { workspace = true } uv-resolver = { workspace = true }
uv-types = { workspace = true } uv-types = { workspace = true }

View file

@ -1,8 +1,8 @@
use {distribution_filename::WheelFilename, platform_tags::Tags}; use uv_bench::criterion::{
use bench::criterion::{
criterion_group, criterion_main, measurement::WallTime, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main, measurement::WallTime, BenchmarkId, Criterion, Throughput,
}; };
use uv_distribution_filename::WheelFilename;
use uv_platform_tags::Tags;
/// A set of platform tags extracted from burntsushi's Archlinux workstation. /// A set of platform tags extracted from burntsushi's Archlinux workstation.
/// We could just re-create these via `Tags::from_env`, but those might differ /// We could just re-create these via `Tags::from_env`, but those might differ
@ -153,10 +153,10 @@ fn benchmark_wheelname_tag_compatibility(c: &mut Criterion<WallTime>) {
} }
criterion_group!( criterion_group!(
distribution_filename, uv_distribution_filename,
benchmark_build_platform_tags, benchmark_build_platform_tags,
benchmark_wheelname_parsing, benchmark_wheelname_parsing,
benchmark_wheelname_parsing_failure, benchmark_wheelname_parsing_failure,
benchmark_wheelname_tag_compatibility, benchmark_wheelname_tag_compatibility,
); );
criterion_main!(distribution_filename); criterion_main!(uv_distribution_filename);

View file

@ -1,32 +1,32 @@
use std::str::FromStr; use std::str::FromStr;
use bench::criterion::black_box; use uv_bench::criterion::black_box;
use bench::criterion::{criterion_group, criterion_main, measurement::WallTime, Criterion}; use uv_bench::criterion::{criterion_group, criterion_main, measurement::WallTime, Criterion};
use pypi_types::Requirement;
use uv_cache::Cache; use uv_cache::Cache;
use uv_client::RegistryClientBuilder; use uv_client::RegistryClientBuilder;
use uv_pypi_types::Requirement;
use uv_python::PythonEnvironment; use uv_python::PythonEnvironment;
use uv_resolver::Manifest; use uv_resolver::Manifest;
fn resolve_warm_jupyter(c: &mut Criterion<WallTime>) { fn resolve_warm_jupyter(c: &mut Criterion<WallTime>) {
let run = setup(Manifest::simple(vec![Requirement::from( let run = setup(Manifest::simple(vec![Requirement::from(
pep508_rs::Requirement::from_str("jupyter==1.0.0").unwrap(), uv_pep508::Requirement::from_str("jupyter==1.0.0").unwrap(),
)])); )]));
c.bench_function("resolve_warm_jupyter", |b| b.iter(|| run(false))); c.bench_function("resolve_warm_jupyter", |b| b.iter(|| run(false)));
} }
fn resolve_warm_jupyter_universal(c: &mut Criterion<WallTime>) { fn resolve_warm_jupyter_universal(c: &mut Criterion<WallTime>) {
let run = setup(Manifest::simple(vec![Requirement::from( let run = setup(Manifest::simple(vec![Requirement::from(
pep508_rs::Requirement::from_str("jupyter==1.0.0").unwrap(), uv_pep508::Requirement::from_str("jupyter==1.0.0").unwrap(),
)])); )]));
c.bench_function("resolve_warm_jupyter_universal", |b| b.iter(|| run(true))); c.bench_function("resolve_warm_jupyter_universal", |b| b.iter(|| run(true)));
} }
fn resolve_warm_airflow(c: &mut Criterion<WallTime>) { fn resolve_warm_airflow(c: &mut Criterion<WallTime>) {
let run = setup(Manifest::simple(vec![ let run = setup(Manifest::simple(vec![
Requirement::from(pep508_rs::Requirement::from_str("apache-airflow[all]==2.9.3").unwrap()), Requirement::from(uv_pep508::Requirement::from_str("apache-airflow[all]==2.9.3").unwrap()),
Requirement::from( Requirement::from(
pep508_rs::Requirement::from_str("apache-airflow-providers-apache-beam>3.0.0").unwrap(), uv_pep508::Requirement::from_str("apache-airflow-providers-apache-beam>3.0.0").unwrap(),
), ),
])); ]));
c.bench_function("resolve_warm_airflow", |b| b.iter(|| run(false))); c.bench_function("resolve_warm_airflow", |b| b.iter(|| run(false)));
@ -35,9 +35,9 @@ fn resolve_warm_airflow(c: &mut Criterion<WallTime>) {
// This takes >5m to run in CodSpeed. // This takes >5m to run in CodSpeed.
// fn resolve_warm_airflow_universal(c: &mut Criterion<WallTime>) { // fn resolve_warm_airflow_universal(c: &mut Criterion<WallTime>) {
// let run = setup(Manifest::simple(vec![ // let run = setup(Manifest::simple(vec![
// Requirement::from(pep508_rs::Requirement::from_str("apache-airflow[all]").unwrap()), // Requirement::from(uv_pep508::Requirement::from_str("apache-airflow[all]").unwrap()),
// Requirement::from( // Requirement::from(
// pep508_rs::Requirement::from_str("apache-airflow-providers-apache-beam>3.0.0").unwrap(), // uv_pep508::Requirement::from_str("apache-airflow-providers-apache-beam>3.0.0").unwrap(),
// ), // ),
// ])); // ]));
// c.bench_function("resolve_warm_airflow_universal", |b| b.iter(|| run(true))); // c.bench_function("resolve_warm_airflow_universal", |b| b.iter(|| run(true)));
@ -83,12 +83,7 @@ mod resolver {
use anyhow::Result; use anyhow::Result;
use distribution_types::{DependencyMetadata, IndexCapabilities, IndexLocations};
use install_wheel_rs::linker::LinkMode; use install_wheel_rs::linker::LinkMode;
use pep440_rs::Version;
use pep508_rs::{MarkerEnvironment, MarkerEnvironmentBuilder};
use platform_tags::{Arch, Os, Platform, Tags};
use pypi_types::ResolverMarkerEnvironment;
use uv_cache::Cache; use uv_cache::Cache;
use uv_client::RegistryClient; use uv_client::RegistryClient;
use uv_configuration::{ use uv_configuration::{
@ -96,7 +91,12 @@ mod resolver {
}; };
use uv_dispatch::BuildDispatch; use uv_dispatch::BuildDispatch;
use uv_distribution::DistributionDatabase; use uv_distribution::DistributionDatabase;
use uv_distribution_types::{DependencyMetadata, IndexCapabilities, IndexLocations};
use uv_git::GitResolver; use uv_git::GitResolver;
use uv_pep440::Version;
use uv_pep508::{MarkerEnvironment, MarkerEnvironmentBuilder};
use uv_platform_tags::{Arch, Os, Platform, Tags};
use uv_pypi_types::ResolverMarkerEnvironment;
use uv_python::Interpreter; use uv_python::Interpreter;
use uv_resolver::{ use uv_resolver::{
FlatIndex, InMemoryIndex, Manifest, OptionsBuilder, PythonRequirement, RequiresPython, FlatIndex, InMemoryIndex, Manifest, OptionsBuilder, PythonRequirement, RequiresPython,

View file

@ -14,12 +14,12 @@ license = { workspace = true }
workspace = true workspace = true
[dependencies] [dependencies]
distribution-types = { workspace = true }
pep440_rs = { workspace = true }
pep508_rs = { workspace = true }
pypi-types = { workspace = true }
uv-configuration = { workspace = true } uv-configuration = { workspace = true }
uv-distribution-types = { workspace = true }
uv-fs = { workspace = true } uv-fs = { workspace = true }
uv-pep440 = { workspace = true }
uv-pep508 = { workspace = true }
uv-pypi-types = { workspace = true }
uv-python = { workspace = true } uv-python = { workspace = true }
uv-types = { workspace = true } uv-types = { workspace = true }
uv-virtualenv = { workspace = true } uv-virtualenv = { workspace = true }

View file

@ -1,7 +1,5 @@
use crate::PythonRunnerOutput; use crate::PythonRunnerOutput;
use itertools::Itertools; use itertools::Itertools;
use pep440_rs::Version;
use pep508_rs::PackageName;
use regex::Regex; use regex::Regex;
use std::env; use std::env;
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
@ -13,6 +11,8 @@ use thiserror::Error;
use tracing::error; use tracing::error;
use uv_configuration::BuildOutput; use uv_configuration::BuildOutput;
use uv_fs::Simplified; use uv_fs::Simplified;
use uv_pep440::Version;
use uv_pep508::PackageName;
/// e.g. `pygraphviz/graphviz_wrap.c:3020:10: fatal error: graphviz/cgraph.h: No such file or directory` /// e.g. `pygraphviz/graphviz_wrap.c:3020:10: fatal error: graphviz/cgraph.h: No such file or directory`
static MISSING_HEADER_RE_GCC: LazyLock<Regex> = LazyLock::new(|| { static MISSING_HEADER_RE_GCC: LazyLock<Regex> = LazyLock::new(|| {
@ -285,11 +285,11 @@ impl Error {
mod test { mod test {
use crate::{Error, PythonRunnerOutput}; use crate::{Error, PythonRunnerOutput};
use indoc::indoc; use indoc::indoc;
use pep440_rs::Version;
use pep508_rs::PackageName;
use std::process::ExitStatus; use std::process::ExitStatus;
use std::str::FromStr; use std::str::FromStr;
use uv_configuration::BuildOutput; use uv_configuration::BuildOutput;
use uv_pep440::Version;
use uv_pep508::PackageName;
#[test] #[test]
fn missing_header() { fn missing_header() {

View file

@ -27,12 +27,12 @@ use tokio::sync::{Mutex, Semaphore};
use tracing::{debug, info_span, instrument, Instrument}; use tracing::{debug, info_span, instrument, Instrument};
pub use crate::error::{Error, MissingHeaderCause}; pub use crate::error::{Error, MissingHeaderCause};
use distribution_types::Resolution;
use pep440_rs::Version;
use pep508_rs::PackageName;
use pypi_types::{Requirement, VerbatimParsedUrl};
use uv_configuration::{BuildKind, BuildOutput, ConfigSettings}; use uv_configuration::{BuildKind, BuildOutput, ConfigSettings};
use uv_distribution_types::Resolution;
use uv_fs::{rename_with_retry, PythonExt, Simplified}; use uv_fs::{rename_with_retry, PythonExt, Simplified};
use uv_pep440::Version;
use uv_pep508::PackageName;
use uv_pypi_types::{Requirement, VerbatimParsedUrl};
use uv_python::{Interpreter, PythonEnvironment}; use uv_python::{Interpreter, PythonEnvironment};
use uv_types::{BuildContext, BuildIsolation, SourceBuildTrait}; use uv_types::{BuildContext, BuildIsolation, SourceBuildTrait};
@ -41,7 +41,7 @@ static DEFAULT_BACKEND: LazyLock<Pep517Backend> = LazyLock::new(|| Pep517Backend
backend: "setuptools.build_meta:__legacy__".to_string(), backend: "setuptools.build_meta:__legacy__".to_string(),
backend_path: None, backend_path: None,
requirements: vec![Requirement::from( requirements: vec![Requirement::from(
pep508_rs::Requirement::from_str("setuptools >= 40.8.0").unwrap(), uv_pep508::Requirement::from_str("setuptools >= 40.8.0").unwrap(),
)], )],
}); });
@ -76,7 +76,7 @@ struct Project {
#[serde(rename_all = "kebab-case")] #[serde(rename_all = "kebab-case")]
struct BuildSystem { struct BuildSystem {
/// PEP 508 dependencies required to execute the build system. /// PEP 508 dependencies required to execute the build system.
requires: Vec<pep508_rs::Requirement<VerbatimParsedUrl>>, requires: Vec<uv_pep508::Requirement<VerbatimParsedUrl>>,
/// A string naming a Python object that will be used to perform the build. /// A string naming a Python object that will be used to perform the build.
build_backend: Option<String>, build_backend: Option<String>,
/// Specify that their backend code is hosted in-tree, this key contains a list of directories. /// Specify that their backend code is hosted in-tree, this key contains a list of directories.
@ -826,7 +826,7 @@ async fn create_pep517_build_environment(
})?; })?;
// Deserialize the requirements from the output file. // Deserialize the requirements from the output file.
let extra_requires: Vec<pep508_rs::Requirement<VerbatimParsedUrl>> = serde_json::from_slice::<Vec<pep508_rs::Requirement<VerbatimParsedUrl>>>(&contents).map_err(|err| { let extra_requires: Vec<uv_pep508::Requirement<VerbatimParsedUrl>> = serde_json::from_slice::<Vec<uv_pep508::Requirement<VerbatimParsedUrl>>>(&contents).map_err(|err| {
Error::from_command_output( Error::from_command_output(
format!( format!(
"Build backend failed to return requirements from `get_requires_for_build_{build_kind}`: {err}" "Build backend failed to return requirements from `get_requires_for_build_{build_kind}`: {err}"

View file

@ -1,5 +1,5 @@
[package] [package]
name = "cache-key" name = "uv-cache-key"
version = "0.0.1" version = "0.0.1"
description = "Generic functionality for caching paths, URLs, and other resources across platforms." description = "Generic functionality for caching paths, URLs, and other resources across platforms."
edition = { workspace = true } edition = { workspace = true }

View file

@ -14,12 +14,12 @@ license = { workspace = true }
workspace = true workspace = true
[dependencies] [dependencies]
cache-key = { workspace = true }
distribution-types = { workspace = true }
pypi-types = { workspace = true }
uv-cache-info = { workspace = true } uv-cache-info = { workspace = true }
uv-cache-key = { workspace = true }
uv-distribution-types = { workspace = true }
uv-fs = { workspace = true, features = ["tokio"] } uv-fs = { workspace = true, features = ["tokio"] }
uv-normalize = { workspace = true } uv-normalize = { workspace = true }
uv-pypi-types = { workspace = true }
clap = { workspace = true, features = ["derive", "env"], optional = true } clap = { workspace = true, features = ["derive", "env"], optional = true }
directories = { workspace = true } directories = { workspace = true }

View file

@ -10,11 +10,11 @@ use rustc_hash::FxHashSet;
use tracing::debug; use tracing::debug;
pub use archive::ArchiveId; pub use archive::ArchiveId;
use distribution_types::InstalledDist;
use pypi_types::ResolutionMetadata;
use uv_cache_info::Timestamp; use uv_cache_info::Timestamp;
use uv_distribution_types::InstalledDist;
use uv_fs::{cachedir, directories}; use uv_fs::{cachedir, directories};
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pypi_types::ResolutionMetadata;
pub use crate::by_timestamp::CachedByTimestamp; pub use crate::by_timestamp::CachedByTimestamp;
#[cfg(feature = "clap")] #[cfg(feature = "clap")]

View file

@ -2,8 +2,8 @@ use std::path::{Path, PathBuf};
use url::Url; use url::Url;
use cache_key::{cache_digest, CanonicalUrl}; use uv_cache_key::{cache_digest, CanonicalUrl};
use distribution_types::IndexUrl; use uv_distribution_types::IndexUrl;
/// Cache wheels and their metadata, both from remote wheels and built from source distributions. /// Cache wheels and their metadata, both from remote wheels and built from source distributions.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]

View file

@ -14,13 +14,13 @@ license = { workspace = true }
workspace = true workspace = true
[dependencies] [dependencies]
distribution-types = { workspace = true }
install-wheel-rs = { workspace = true, features = ["clap"], default-features = false }
pep508_rs = { workspace = true }
pypi-types = { workspace = true }
uv-cache = { workspace = true, features = ["clap"] } uv-cache = { workspace = true, features = ["clap"] }
uv-configuration = { workspace = true, features = ["clap"] } uv-configuration = { workspace = true, features = ["clap"] }
uv-distribution-types = { workspace = true }
uv-install-wheel = { workspace = true, features = ["clap"], default-features = false }
uv-normalize = { workspace = true } uv-normalize = { workspace = true }
uv-pep508 = { workspace = true }
uv-pypi-types = { workspace = true }
uv-python = { workspace = true, features = ["clap", "schemars"]} uv-python = { workspace = true, features = ["clap", "schemars"]}
uv-resolver = { workspace = true, features = ["clap"] } uv-resolver = { workspace = true, features = ["clap"] }
uv-settings = { workspace = true, features = ["schemars"] } uv-settings = { workspace = true, features = ["schemars"] }

View file

@ -7,16 +7,16 @@ use anyhow::{anyhow, Result};
use clap::builder::styling::{AnsiColor, Effects, Style}; use clap::builder::styling::{AnsiColor, Effects, Style};
use clap::builder::Styles; use clap::builder::Styles;
use clap::{Args, Parser, Subcommand}; use clap::{Args, Parser, Subcommand};
use distribution_types::{FlatIndexLocation, IndexUrl};
use pep508_rs::Requirement;
use pypi_types::VerbatimParsedUrl;
use url::Url; use url::Url;
use uv_cache::CacheArgs; use uv_cache::CacheArgs;
use uv_configuration::{ use uv_configuration::{
ConfigSettingEntry, ExportFormat, IndexStrategy, KeyringProviderType, PackageNameSpecifier, ConfigSettingEntry, ExportFormat, IndexStrategy, KeyringProviderType, PackageNameSpecifier,
TargetTriple, TrustedHost, TrustedPublishing, VersionControlSystem, TargetTriple, TrustedHost, TrustedPublishing, VersionControlSystem,
}; };
use uv_distribution_types::{FlatIndexLocation, IndexUrl};
use uv_normalize::{ExtraName, PackageName}; use uv_normalize::{ExtraName, PackageName};
use uv_pep508::Requirement;
use uv_pypi_types::VerbatimParsedUrl;
use uv_python::{PythonDownloads, PythonPreference, PythonVersion}; use uv_python::{PythonDownloads, PythonPreference, PythonVersion};
use uv_resolver::{AnnotationStyle, ExcludeNewer, PrereleaseMode, ResolutionMode}; use uv_resolver::{AnnotationStyle, ExcludeNewer, PrereleaseMode, ResolutionMode};

View file

@ -7,19 +7,19 @@ edition = "2021"
workspace = true workspace = true
[dependencies] [dependencies]
cache-key = { workspace = true }
distribution-filename = { workspace = true }
distribution-types = { workspace = true }
pep440_rs = { workspace = true }
pep508_rs = { workspace = true }
platform-tags = { workspace = true }
pypi-types = { workspace = true }
uv-auth = { workspace = true } uv-auth = { workspace = true }
uv-cache = { workspace = true } uv-cache = { workspace = true }
uv-cache-key = { workspace = true }
uv-configuration = { workspace = true } uv-configuration = { workspace = true }
uv-distribution-filename = { workspace = true }
uv-distribution-types = { workspace = true }
uv-fs = { workspace = true, features = ["tokio"] } uv-fs = { workspace = true, features = ["tokio"] }
uv-metadata = { workspace = true } uv-metadata = { workspace = true }
uv-normalize = { workspace = true } uv-normalize = { workspace = true }
uv-pep440 = { workspace = true }
uv-pep508 = { workspace = true }
uv-platform-tags = { workspace = true }
uv-pypi-types = { workspace = true }
uv-version = { workspace = true } uv-version = { workspace = true }
uv-warnings = { workspace = true } uv-warnings = { workspace = true }

View file

@ -4,8 +4,6 @@ use std::path::Path;
use std::{env, iter}; use std::{env, iter};
use itertools::Itertools; use itertools::Itertools;
use pep508_rs::MarkerEnvironment;
use platform_tags::Platform;
use reqwest::{Client, ClientBuilder, Response}; use reqwest::{Client, ClientBuilder, Response};
use reqwest_middleware::ClientWithMiddleware; use reqwest_middleware::ClientWithMiddleware;
use reqwest_retry::policies::ExponentialBackoff; use reqwest_retry::policies::ExponentialBackoff;
@ -17,6 +15,8 @@ use url::Url;
use uv_auth::AuthMiddleware; use uv_auth::AuthMiddleware;
use uv_configuration::{KeyringProviderType, TrustedHost}; use uv_configuration::{KeyringProviderType, TrustedHost};
use uv_fs::Simplified; use uv_fs::Simplified;
use uv_pep508::MarkerEnvironment;
use uv_platform_tags::Platform;
use uv_version::version; use uv_version::version;
use uv_warnings::warn_user_once; use uv_warnings::warn_user_once;

View file

@ -5,7 +5,7 @@ use async_http_range_reader::AsyncHttpRangeReaderError;
use async_zip::error::ZipError; use async_zip::error::ZipError;
use url::Url; use url::Url;
use distribution_filename::{WheelFilename, WheelFilenameError}; use uv_distribution_filename::{WheelFilename, WheelFilenameError};
use uv_normalize::PackageName; use uv_normalize::PackageName;
use crate::html; use crate::html;
@ -140,7 +140,7 @@ pub enum ErrorKind {
UrlParse(#[from] url::ParseError), UrlParse(#[from] url::ParseError),
#[error(transparent)] #[error(transparent)]
JoinRelativeUrl(#[from] pypi_types::JoinRelativeError), JoinRelativeUrl(#[from] uv_pypi_types::JoinRelativeError),
#[error("Expected a file URL, but received: {0}")] #[error("Expected a file URL, but received: {0}")]
NonFileUrl(Url), NonFileUrl(Url),
@ -170,7 +170,7 @@ pub enum ErrorKind {
MetadataParseError( MetadataParseError(
WheelFilename, WheelFilename,
String, String,
#[source] Box<pypi_types::MetadataError>, #[source] Box<uv_pypi_types::MetadataError>,
), ),
/// The metadata file was not found in the wheel. /// The metadata file was not found in the wheel.

View file

@ -5,13 +5,13 @@ use reqwest::Response;
use tracing::{debug, info_span, warn, Instrument}; use tracing::{debug, info_span, warn, Instrument};
use url::Url; use url::Url;
use distribution_filename::DistFilename;
use distribution_types::{File, FileLocation, FlatIndexLocation, IndexUrl, UrlString};
use uv_cache::{Cache, CacheBucket};
use crate::cached_client::{CacheControl, CachedClientError}; use crate::cached_client::{CacheControl, CachedClientError};
use crate::html::SimpleHtml; use crate::html::SimpleHtml;
use crate::{Connectivity, Error, ErrorKind, OwnedArchive, RegistryClient}; use crate::{Connectivity, Error, ErrorKind, OwnedArchive, RegistryClient};
use uv_cache::{Cache, CacheBucket};
use uv_cache_key::cache_digest;
use uv_distribution_filename::DistFilename;
use uv_distribution_types::{File, FileLocation, FlatIndexLocation, IndexUrl, UrlString};
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
pub enum FlatIndexError { pub enum FlatIndexError {
@ -30,7 +30,7 @@ pub enum FindLinksDirectoryError {
#[error(transparent)] #[error(transparent)]
Io(#[from] std::io::Error), Io(#[from] std::io::Error),
#[error(transparent)] #[error(transparent)]
VerbatimUrl(#[from] pep508_rs::VerbatimUrlError), VerbatimUrl(#[from] uv_pep508::VerbatimUrlError),
} }
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, Clone)]
@ -141,7 +141,7 @@ impl<'a> FlatIndexClient<'a> {
let cache_entry = self.cache.entry( let cache_entry = self.cache.entry(
CacheBucket::FlatIndex, CacheBucket::FlatIndex,
"html", "html",
format!("{}.msgpack", cache_key::cache_digest(&url.to_string())), format!("{}.msgpack", cache_digest(&url.to_string())),
); );
let cache_control = match self.client.connectivity() { let cache_control = match self.client.connectivity() {
Connectivity::Online => CacheControl::from( Connectivity::Online => CacheControl::from(

View file

@ -4,9 +4,9 @@ use tl::HTMLTag;
use tracing::{instrument, warn}; use tracing::{instrument, warn};
use url::Url; use url::Url;
use pep440_rs::VersionSpecifiers; use uv_pep440::VersionSpecifiers;
use pypi_types::LenientVersionSpecifiers; use uv_pypi_types::LenientVersionSpecifiers;
use pypi_types::{BaseUrl, CoreMetadata, File, Hashes, Yanked}; use uv_pypi_types::{BaseUrl, CoreMetadata, File, Hashes, Yanked};
/// A parsed structure from PyPI "HTML" index format for a single package. /// A parsed structure from PyPI "HTML" index format for a single package.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -200,10 +200,10 @@ pub enum Error {
MissingHash(String), MissingHash(String),
#[error(transparent)] #[error(transparent)]
FragmentParse(#[from] pypi_types::HashError), FragmentParse(#[from] uv_pypi_types::HashError),
#[error("Invalid `requires-python` specifier: {0}")] #[error("Invalid `requires-python` specifier: {0}")]
Pep440(#[source] pep440_rs::VersionSpecifiersParseError), Pep440(#[source] uv_pep440::VersionSpecifiersParseError),
} }
#[cfg(test)] #[cfg(test)]

View file

@ -3,8 +3,8 @@ use std::env;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tracing::instrument; use tracing::instrument;
use pep508_rs::MarkerEnvironment; use uv_pep508::MarkerEnvironment;
use platform_tags::{Os, Platform}; use uv_platform_tags::{Os, Platform};
use uv_version::version; use uv_version::version;
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
@ -68,7 +68,7 @@ impl LineHaul {
.iter() .iter()
.find_map(|&var_name| env::var(var_name).ok().map(|_| true)); .find_map(|&var_name| env::var(var_name).ok().map(|_| true));
let libc = match platform.map(platform_tags::Platform::os) { let libc = match platform.map(Platform::os) {
Some(Os::Manylinux { major, minor }) => Some(Libc { Some(Os::Manylinux { major, minor }) => Some(Libc {
lib: Some("glibc".to_string()), lib: Some("glibc".to_string()),
version: Some(format!("{major}.{minor}")), version: Some(format!("{major}.{minor}")),
@ -94,7 +94,7 @@ impl LineHaul {
libc, libc,
}) })
} else if cfg!(target_os = "macos") { } else if cfg!(target_os = "macos") {
let version = match platform.map(platform_tags::Platform::os) { let version = match platform.map(Platform::os) {
Some(Os::Macos { major, minor }) => Some(format!("{major}.{minor}")), Some(Os::Macos { major, minor }) => Some(format!("{major}.{minor}")),
_ => None, _ => None,
}; };

View file

@ -11,19 +11,19 @@ use reqwest_middleware::ClientWithMiddleware;
use tracing::{info_span, instrument, trace, warn, Instrument}; use tracing::{info_span, instrument, trace, warn, Instrument};
use url::Url; use url::Url;
use distribution_filename::{DistFilename, SourceDistFilename, WheelFilename};
use distribution_types::{
BuiltDist, File, FileLocation, IndexCapabilities, IndexUrl, IndexUrls, Name,
};
use pep440_rs::Version;
use pep508_rs::MarkerEnvironment;
use platform_tags::Platform;
use pypi_types::{ResolutionMetadata, SimpleJson};
use uv_cache::{Cache, CacheBucket, CacheEntry, WheelCache}; use uv_cache::{Cache, CacheBucket, CacheEntry, WheelCache};
use uv_configuration::KeyringProviderType; use uv_configuration::KeyringProviderType;
use uv_configuration::{IndexStrategy, TrustedHost}; use uv_configuration::{IndexStrategy, TrustedHost};
use uv_distribution_filename::{DistFilename, SourceDistFilename, WheelFilename};
use uv_distribution_types::{
BuiltDist, File, FileLocation, IndexCapabilities, IndexUrl, IndexUrls, Name,
};
use uv_metadata::{read_metadata_async_seek, read_metadata_async_stream}; use uv_metadata::{read_metadata_async_seek, read_metadata_async_stream};
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pep440::Version;
use uv_pep508::MarkerEnvironment;
use uv_platform_tags::Platform;
use uv_pypi_types::{ResolutionMetadata, SimpleJson};
use crate::base_client::BaseClientBuilder; use crate::base_client::BaseClientBuilder;
use crate::cached_client::CacheControl; use crate::cached_client::CacheControl;
@ -419,7 +419,7 @@ impl RegistryClient {
let location = match &wheel.file.url { let location = match &wheel.file.url {
FileLocation::RelativeUrl(base, url) => { FileLocation::RelativeUrl(base, url) => {
let url = pypi_types::base_url_join_relative(base, url) let url = uv_pypi_types::base_url_join_relative(base, url)
.map_err(ErrorKind::JoinRelativeUrl)?; .map_err(ErrorKind::JoinRelativeUrl)?;
if url.scheme() == "file" { if url.scheme() == "file" {
let path = url let path = url
@ -783,7 +783,7 @@ impl SimpleMetadata {
self.0.iter() self.0.iter()
} }
fn from_files(files: Vec<pypi_types::File>, package_name: &PackageName, base: &Url) -> Self { fn from_files(files: Vec<uv_pypi_types::File>, package_name: &PackageName, base: &Url) -> Self {
let mut map: BTreeMap<Version, VersionFiles> = BTreeMap::default(); let mut map: BTreeMap<Version, VersionFiles> = BTreeMap::default();
// Group the distributions by version and kind // Group the distributions by version and kind
@ -906,8 +906,8 @@ mod tests {
use url::Url; use url::Url;
use pypi_types::{JoinRelativeError, SimpleJson};
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pypi_types::{JoinRelativeError, SimpleJson};
use crate::{html::SimpleHtml, SimpleMetadata, SimpleMetadatum}; use crate::{html::SimpleHtml, SimpleMetadata, SimpleMetadatum};
@ -991,7 +991,7 @@ mod tests {
// Test parsing of the file urls // Test parsing of the file urls
let urls = files let urls = files
.iter() .iter()
.map(|file| pypi_types::base_url_join_relative(base.as_url().as_str(), &file.url)) .map(|file| uv_pypi_types::base_url_join_relative(base.as_url().as_str(), &file.url))
.collect::<Result<Vec<_>, JoinRelativeError>>()?; .collect::<Result<Vec<_>, JoinRelativeError>>()?;
let urls = urls.iter().map(reqwest::Url::as_str).collect::<Vec<_>>(); let urls = urls.iter().map(reqwest::Url::as_str).collect::<Vec<_>>();
insta::assert_debug_snapshot!(urls, @r###" insta::assert_debug_snapshot!(urls, @r###"

View file

@ -1,9 +1,9 @@
use crate::{Error, ErrorKind}; use crate::{Error, ErrorKind};
use async_http_range_reader::AsyncHttpRangeReader; use async_http_range_reader::AsyncHttpRangeReader;
use distribution_filename::WheelFilename;
use futures::io::BufReader; use futures::io::BufReader;
use tokio_util::compat::TokioAsyncReadCompatExt; use tokio_util::compat::TokioAsyncReadCompatExt;
use url::Url; use url::Url;
use uv_distribution_filename::WheelFilename;
use uv_metadata::find_archive_dist_info; use uv_metadata::find_archive_dist_info;
/// Read the `.dist-info/METADATA` file from a async remote zip reader, so we avoid downloading the /// Read the `.dist-info/METADATA` file from a async remote zip reader, so we avoid downloading the

View file

@ -3,11 +3,11 @@ use std::str::FromStr;
use anyhow::Result; use anyhow::Result;
use url::Url; use url::Url;
use distribution_filename::WheelFilename;
use distribution_types::{BuiltDist, DirectUrlBuiltDist, IndexCapabilities};
use pep508_rs::VerbatimUrl;
use uv_cache::Cache; use uv_cache::Cache;
use uv_client::RegistryClientBuilder; use uv_client::RegistryClientBuilder;
use uv_distribution_filename::WheelFilename;
use uv_distribution_types::{BuiltDist, DirectUrlBuiltDist, IndexCapabilities};
use uv_pep508::VerbatimUrl;
#[tokio::test] #[tokio::test]
async fn remote_metadata_with_and_without_cache() -> Result<()> { async fn remote_metadata_with_and_without_cache() -> Result<()> {

View file

@ -10,11 +10,11 @@ use hyper_util::rt::TokioIo;
use insta::{assert_json_snapshot, assert_snapshot, with_settings}; use insta::{assert_json_snapshot, assert_snapshot, with_settings};
use tokio::net::TcpListener; use tokio::net::TcpListener;
use pep508_rs::{MarkerEnvironment, MarkerEnvironmentBuilder};
use platform_tags::{Arch, Os, Platform};
use uv_cache::Cache; use uv_cache::Cache;
use uv_client::LineHaul; use uv_client::LineHaul;
use uv_client::RegistryClientBuilder; use uv_client::RegistryClientBuilder;
use uv_pep508::{MarkerEnvironment, MarkerEnvironmentBuilder};
use uv_platform_tags::{Arch, Os, Platform};
use uv_version::version; use uv_version::version;
#[tokio::test] #[tokio::test]

View file

@ -13,14 +13,14 @@ license = { workspace = true }
workspace = true workspace = true
[dependencies] [dependencies]
cache-key = { workspace = true }
pep508_rs = { workspace = true, features = ["schemars"] }
platform-tags = { workspace = true }
pypi-types = { workspace = true }
uv-auth = { workspace = true } uv-auth = { workspace = true }
uv-cache = { workspace = true } uv-cache = { workspace = true }
uv-cache-info = { workspace = true } uv-cache-info = { workspace = true }
uv-cache-key = { workspace = true }
uv-normalize = { workspace = true } uv-normalize = { workspace = true }
uv-pep508 = { workspace = true, features = ["schemars"] }
uv-platform-tags = { workspace = true }
uv-pypi-types = { workspace = true }
clap = { workspace = true, features = ["derive"], optional = true } clap = { workspace = true, features = ["derive"], optional = true }
either = { workspace = true } either = { workspace = true }

View file

@ -1,6 +1,6 @@
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
use pep508_rs::PackageName; use uv_pep508::PackageName;
use crate::{PackageNameSpecifier, PackageNameSpecifiers}; use crate::{PackageNameSpecifier, PackageNameSpecifiers};

View file

@ -1,8 +1,8 @@
use cache_key::CacheKeyHasher;
use std::{ use std::{
collections::{btree_map::Entry, BTreeMap}, collections::{btree_map::Entry, BTreeMap},
str::FromStr, str::FromStr,
}; };
use uv_cache_key::CacheKeyHasher;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ConfigSettingEntry { pub struct ConfigSettingEntry {
@ -161,7 +161,7 @@ impl ConfigSettings {
} }
} }
impl cache_key::CacheKey for ConfigSettings { impl uv_cache_key::CacheKey for ConfigSettings {
fn cache_key(&self, state: &mut CacheKeyHasher) { fn cache_key(&self, state: &mut CacheKeyHasher) {
for (key, value) in &self.0 { for (key, value) in &self.0 {
key.cache_key(state); key.cache_key(state);

View file

@ -3,9 +3,9 @@ use std::borrow::Cow;
use either::Either; use either::Either;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use pep508_rs::MarkerTree;
use pypi_types::{Requirement, RequirementSource};
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pep508::MarkerTree;
use uv_pypi_types::{Requirement, RequirementSource};
/// A set of constraints for a set of requirements. /// A set of constraints for a set of requirements.
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, Clone)]

View file

@ -2,7 +2,7 @@ use std::collections::BTreeSet;
use tracing::debug; use tracing::debug;
use pep508_rs::PackageName; use uv_pep508::PackageName;
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]
pub struct InstallOptions { pub struct InstallOptions {

View file

@ -1,6 +1,6 @@
use std::str::FromStr; use std::str::FromStr;
use pep508_rs::PackageName; use uv_pep508::PackageName;
/// A specifier used for (e.g.) pip's `--no-binary` flag. /// A specifier used for (e.g.) pip's `--no-binary` flag.
/// ///

View file

@ -3,9 +3,9 @@ use std::borrow::Cow;
use either::Either; use either::Either;
use rustc_hash::{FxBuildHasher, FxHashMap}; use rustc_hash::{FxBuildHasher, FxHashMap};
use pep508_rs::MarkerTree;
use pypi_types::Requirement;
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pep508::MarkerTree;
use uv_pypi_types::Requirement;
/// A set of overrides for a set of requirements. /// A set of overrides for a set of requirements.
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, Clone)]

View file

@ -1,10 +1,10 @@
use either::Either; use either::Either;
use pep508_rs::PackageName; use uv_pep508::PackageName;
use pypi_types::Requirement;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use uv_cache::Refresh; use uv_cache::Refresh;
use uv_cache_info::Timestamp; use uv_cache_info::Timestamp;
use uv_pypi_types::Requirement;
/// Whether to reinstall packages. /// Whether to reinstall packages.
#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)] #[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]

View file

@ -1,7 +1,7 @@
use tracing::debug; use tracing::debug;
use pep508_rs::MarkerEnvironment; use uv_pep508::MarkerEnvironment;
use platform_tags::{Arch, Os, Platform}; use uv_platform_tags::{Arch, Os, Platform};
/// The supported target triples. Each triple consists of an architecture, vendor, and operating /// The supported target triples. Each triple consists of an architecture, vendor, and operating
/// system. /// system.

View file

@ -16,16 +16,16 @@ license = { workspace = true }
workspace = true workspace = true
[dependencies] [dependencies]
distribution-filename = { workspace = true }
distribution-types = { workspace = true }
pep508_rs = { workspace = true }
pypi-types = { workspace = true }
uv-cache = { workspace = true, features = ["clap"] } uv-cache = { workspace = true, features = ["clap"] }
uv-cli = { workspace = true } uv-cli = { workspace = true }
uv-client = { workspace = true } uv-client = { workspace = true }
uv-distribution-filename = { workspace = true }
uv-distribution-types = { workspace = true }
uv-installer = { workspace = true } uv-installer = { workspace = true }
uv-macros = { workspace = true } uv-macros = { workspace = true }
uv-options-metadata = { workspace = true } uv-options-metadata = { workspace = true }
uv-pep508 = { workspace = true }
uv-pypi-types = { workspace = true }
uv-python = { workspace = true } uv-python = { workspace = true }
uv-settings = { workspace = true, features = ["schemars"] } uv-settings = { workspace = true, features = ["schemars"] }
uv-workspace = { workspace = true, features = ["schemars"] } uv-workspace = { workspace = true, features = ["schemars"] }

View file

@ -4,12 +4,12 @@ use anstream::println;
use anyhow::{bail, Result}; use anyhow::{bail, Result};
use clap::Parser; use clap::Parser;
use distribution_filename::WheelFilename;
use distribution_types::{BuiltDist, DirectUrlBuiltDist, IndexCapabilities, RemoteSource};
use pep508_rs::VerbatimUrl;
use pypi_types::ParsedUrl;
use uv_cache::{Cache, CacheArgs}; use uv_cache::{Cache, CacheArgs};
use uv_client::RegistryClientBuilder; use uv_client::RegistryClientBuilder;
use uv_distribution_filename::WheelFilename;
use uv_distribution_types::{BuiltDist, DirectUrlBuiltDist, IndexCapabilities, RemoteSource};
use uv_pep508::VerbatimUrl;
use uv_pypi_types::ParsedUrl;
#[derive(Parser)] #[derive(Parser)]
pub(crate) struct WheelMetadataArgs { pub(crate) struct WheelMetadataArgs {

View file

@ -14,16 +14,16 @@ license = { workspace = true }
workspace = true workspace = true
[dependencies] [dependencies]
distribution-types = { workspace = true }
install-wheel-rs = { workspace = true }
pypi-types = { workspace = true }
uv-build-frontend = { workspace = true } uv-build-frontend = { workspace = true }
uv-cache = { workspace = true } uv-cache = { workspace = true }
uv-client = { workspace = true } uv-client = { workspace = true }
uv-configuration = { workspace = true } uv-configuration = { workspace = true }
uv-distribution = { workspace = true } uv-distribution = { workspace = true }
uv-distribution-types = { workspace = true }
uv-git = { workspace = true } uv-git = { workspace = true }
uv-install-wheel = { workspace = true }
uv-installer = { workspace = true } uv-installer = { workspace = true }
uv-pypi-types = { workspace = true }
uv-python = { workspace = true } uv-python = { workspace = true }
uv-resolver = { workspace = true } uv-resolver = { workspace = true }
uv-types = { workspace = true } uv-types = { workspace = true }

View file

@ -11,11 +11,6 @@ use itertools::Itertools;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use tracing::{debug, instrument}; use tracing::{debug, instrument};
use distribution_types::{
CachedDist, DependencyMetadata, IndexCapabilities, IndexLocations, Name, Resolution,
SourceDist, VersionOrUrlRef,
};
use pypi_types::Requirement;
use uv_build_frontend::{SourceBuild, SourceBuildContext}; use uv_build_frontend::{SourceBuild, SourceBuildContext};
use uv_cache::Cache; use uv_cache::Cache;
use uv_client::RegistryClient; use uv_client::RegistryClient;
@ -24,8 +19,13 @@ use uv_configuration::{
}; };
use uv_configuration::{BuildOutput, Concurrency}; use uv_configuration::{BuildOutput, Concurrency};
use uv_distribution::DistributionDatabase; use uv_distribution::DistributionDatabase;
use uv_distribution_types::{
CachedDist, DependencyMetadata, IndexCapabilities, IndexLocations, Name, Resolution,
SourceDist, VersionOrUrlRef,
};
use uv_git::GitResolver; use uv_git::GitResolver;
use uv_installer::{Installer, Plan, Planner, Preparer, SitePackages}; use uv_installer::{Installer, Plan, Planner, Preparer, SitePackages};
use uv_pypi_types::Requirement;
use uv_python::{Interpreter, PythonEnvironment}; use uv_python::{Interpreter, PythonEnvironment};
use uv_resolver::{ use uv_resolver::{
ExcludeNewer, FlatIndex, InMemoryIndex, Manifest, OptionsBuilder, PythonRequirement, Resolver, ExcludeNewer, FlatIndex, InMemoryIndex, Manifest, OptionsBuilder, PythonRequirement, Resolver,
@ -314,9 +314,9 @@ impl<'a> BuildContext for BuildDispatch<'a> {
build_kind: BuildKind, build_kind: BuildKind,
build_output: BuildOutput, build_output: BuildOutput,
) -> Result<SourceBuild> { ) -> Result<SourceBuild> {
let dist_name = dist.map(distribution_types::Name::name); let dist_name = dist.map(uv_distribution_types::Name::name);
let dist_version = dist let dist_version = dist
.map(distribution_types::DistributionMetadata::version_or_url) .map(uv_distribution_types::DistributionMetadata::version_or_url)
.and_then(|version| match version { .and_then(|version| match version {
VersionOrUrlRef::Version(version) => Some(version), VersionOrUrlRef::Version(version) => Some(version),
VersionOrUrlRef::Url(_) => None, VersionOrUrlRef::Url(_) => None,

View file

@ -1,5 +1,5 @@
[package] [package]
name = "distribution-filename" name = "uv-distribution-filename"
version = "0.0.1" version = "0.0.1"
edition = { workspace = true } edition = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
@ -13,9 +13,9 @@ license = { workspace = true }
workspace = true workspace = true
[dependencies] [dependencies]
pep440_rs = { workspace = true }
platform-tags = { workspace = true }
uv-normalize = { workspace = true } uv-normalize = { workspace = true }
uv-pep440 = { workspace = true }
uv-platform-tags = { workspace = true }
rkyv = { workspace = true } rkyv = { workspace = true }
serde = { workspace = true } serde = { workspace = true }

View file

@ -2,8 +2,8 @@ use std::str::FromStr;
use thiserror::Error; use thiserror::Error;
use pep440_rs::{Version, VersionParseError};
use uv_normalize::{InvalidNameError, PackageName}; use uv_normalize::{InvalidNameError, PackageName};
use uv_pep440::{Version, VersionParseError};
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum EggInfoFilenameError { pub enum EggInfoFilenameError {

View file

@ -1,7 +1,7 @@
use pep440_rs::Version;
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
use std::str::FromStr; use std::str::FromStr;
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pep440::Version;
pub use build_tag::{BuildTag, BuildTagError}; pub use build_tag::{BuildTag, BuildTagError};
pub use egg::{EggInfoFilename, EggInfoFilenameError}; pub use egg::{EggInfoFilename, EggInfoFilenameError};

View file

@ -1,5 +1,5 @@
--- ---
source: crates/distribution-filename/src/wheel.rs source: crates/uv-distribution-filename/src/wheel.rs
expression: "WheelFilename::from_str(\"foo-1.2.3-202206090410-python-abi-platform.whl\")" expression: "WheelFilename::from_str(\"foo-1.2.3-202206090410-python-abi-platform.whl\")"
--- ---
Ok( Ok(

View file

@ -1,5 +1,5 @@
--- ---
source: crates/distribution-filename/src/wheel.rs source: crates/uv-distribution-filename/src/wheel.rs
expression: "WheelFilename::from_str(\"foo-1.2.3-ab.cd.ef-gh-ij.kl.mn.op.qr.st.whl\")" expression: "WheelFilename::from_str(\"foo-1.2.3-ab.cd.ef-gh-ij.kl.mn.op.qr.st.whl\")"
--- ---
Ok( Ok(

View file

@ -1,5 +1,5 @@
--- ---
source: crates/distribution-filename/src/wheel.rs source: crates/uv-distribution-filename/src/wheel.rs
expression: "WheelFilename::from_str(\"foo-1.2.3-foo-bar-baz.whl\")" expression: "WheelFilename::from_str(\"foo-1.2.3-foo-bar-baz.whl\")"
--- ---
Ok( Ok(

View file

@ -2,10 +2,10 @@ use std::fmt::{Display, Formatter};
use std::str::FromStr; use std::str::FromStr;
use crate::SourceDistExtension; use crate::SourceDistExtension;
use pep440_rs::{Version, VersionParseError};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use thiserror::Error; use thiserror::Error;
use uv_normalize::{InvalidNameError, PackageName}; use uv_normalize::{InvalidNameError, PackageName};
use uv_pep440::{Version, VersionParseError};
/// Note that this is a normalized and not an exact representation, keep the original string if you /// Note that this is a normalized and not an exact representation, keep the original string if you
/// need the latter. /// need the latter.

View file

@ -5,9 +5,9 @@ use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
use thiserror::Error; use thiserror::Error;
use url::Url; use url::Url;
use pep440_rs::{Version, VersionParseError};
use platform_tags::{TagCompatibility, Tags};
use uv_normalize::{InvalidNameError, PackageName}; use uv_normalize::{InvalidNameError, PackageName};
use uv_pep440::{Version, VersionParseError};
use uv_platform_tags::{TagCompatibility, Tags};
use crate::{BuildTag, BuildTagError}; use crate::{BuildTag, BuildTagError};

View file

@ -1,5 +1,5 @@
[package] [package]
name = "distribution-types" name = "uv-distribution-types"
version = "0.0.1" version = "0.0.1"
edition = { workspace = true } edition = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
@ -13,16 +13,16 @@ license = { workspace = true }
workspace = true workspace = true
[dependencies] [dependencies]
cache-key = { workspace = true }
distribution-filename = { workspace = true }
pep440_rs = { workspace = true }
pep508_rs = { workspace = true, features = ["serde"] }
platform-tags = { workspace = true }
pypi-types = { workspace = true }
uv-cache-info = { workspace = true } uv-cache-info = { workspace = true }
uv-cache-key = { workspace = true }
uv-distribution-filename = { workspace = true }
uv-fs = { workspace = true } uv-fs = { workspace = true }
uv-git = { workspace = true } uv-git = { workspace = true }
uv-normalize = { workspace = true } uv-normalize = { workspace = true }
uv-pep440 = { workspace = true }
uv-pep508 = { workspace = true, features = ["serde"] }
uv-platform-tags = { workspace = true }
uv-pypi-types = { workspace = true }
anyhow = { workspace = true } anyhow = { workspace = true }
fs-err = { workspace = true } fs-err = { workspace = true }

View file

@ -1,8 +1,8 @@
use std::collections::{BTreeMap, BTreeSet}; use std::collections::{BTreeMap, BTreeSet};
use pep508_rs::RequirementOrigin;
use uv_fs::Simplified; use uv_fs::Simplified;
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pep508::RequirementOrigin;
/// Source of a dependency, e.g., a `-r requirements.txt` file. /// Source of a dependency, e.g., a `-r requirements.txt` file.
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]

View file

@ -1,11 +1,11 @@
use std::borrow::Cow; use std::borrow::Cow;
use std::path::Path; use std::path::Path;
use distribution_filename::SourceDistExtension;
use pep440_rs::Version;
use pep508_rs::VerbatimUrl;
use url::Url; use url::Url;
use uv_distribution_filename::SourceDistExtension;
use uv_git::GitUrl; use uv_git::GitUrl;
use uv_pep440::Version;
use uv_pep508::VerbatimUrl;
use uv_normalize::PackageName; use uv_normalize::PackageName;

View file

@ -2,11 +2,11 @@ use std::path::{Path, PathBuf};
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use distribution_filename::WheelFilename;
use pep508_rs::VerbatimUrl;
use pypi_types::{HashDigest, ParsedDirectoryUrl};
use uv_cache_info::CacheInfo; use uv_cache_info::CacheInfo;
use uv_distribution_filename::WheelFilename;
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pep508::VerbatimUrl;
use uv_pypi_types::{HashDigest, ParsedDirectoryUrl};
use crate::{ use crate::{
BuiltDist, Dist, DistributionMetadata, Hashed, InstalledMetadata, InstalledVersion, Name, BuiltDist, Dist, DistributionMetadata, Hashed, InstalledMetadata, InstalledVersion, Name,

View file

@ -1,9 +1,9 @@
use pep440_rs::{Version, VersionSpecifiers};
use pep508_rs::Requirement;
use pypi_types::{ResolutionMetadata, VerbatimParsedUrl};
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use uv_normalize::{ExtraName, PackageName}; use uv_normalize::{ExtraName, PackageName};
use uv_pep440::{Version, VersionSpecifiers};
use uv_pep508::Requirement;
use uv_pypi_types::{ResolutionMetadata, VerbatimParsedUrl};
/// Pre-defined [`StaticMetadata`] entries, indexed by [`PackageName`] and [`Version`]. /// Pre-defined [`StaticMetadata`] entries, indexed by [`PackageName`] and [`Version`].
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]

View file

@ -11,7 +11,7 @@ pub enum Error {
Utf8(#[from] std::string::FromUtf8Error), Utf8(#[from] std::string::FromUtf8Error),
#[error(transparent)] #[error(transparent)]
WheelFilename(#[from] distribution_filename::WheelFilenameError), WheelFilename(#[from] uv_distribution_filename::WheelFilenameError),
#[error("Could not extract path segments from URL: {0}")] #[error("Could not extract path segments from URL: {0}")]
MissingPathSegments(String), MissingPathSegments(String),

View file

@ -7,11 +7,11 @@ use jiff::Timestamp;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use url::Url; use url::Url;
use pep440_rs::{VersionSpecifiers, VersionSpecifiersParseError}; use uv_pep440::{VersionSpecifiers, VersionSpecifiersParseError};
use pep508_rs::VerbatimUrl; use uv_pep508::VerbatimUrl;
use pypi_types::{CoreMetadata, HashDigest, Yanked}; use uv_pypi_types::{CoreMetadata, HashDigest, Yanked};
/// Error converting [`pypi_types::File`] to [`distribution_type::File`]. /// Error converting [`uv_pypi_types::File`] to [`distribution_type::File`].
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
pub enum FileConversionError { pub enum FileConversionError {
#[error("Failed to parse `requires-python`: `{0}`")] #[error("Failed to parse `requires-python`: `{0}`")]
@ -20,7 +20,7 @@ pub enum FileConversionError {
Url(String, #[source] url::ParseError), Url(String, #[source] url::ParseError),
} }
/// Internal analog to [`pypi_types::File`]. /// Internal analog to [`uv_pypi_types::File`].
#[derive(Debug, Clone, Hash, rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)] #[derive(Debug, Clone, Hash, rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)]
#[rkyv(derive(Debug))] #[rkyv(derive(Debug))]
pub struct File { pub struct File {
@ -40,7 +40,7 @@ pub struct File {
impl File { impl File {
/// `TryFrom` instead of `From` to filter out files with invalid requires python version specifiers /// `TryFrom` instead of `From` to filter out files with invalid requires python version specifiers
pub fn try_from(file: pypi_types::File, base: &Url) -> Result<Self, FileConversionError> { pub fn try_from(file: uv_pypi_types::File, base: &Url) -> Result<Self, FileConversionError> {
Ok(Self { Ok(Self {
dist_info_metadata: file dist_info_metadata: file
.core_metadata .core_metadata

View file

@ -1,4 +1,4 @@
use pypi_types::{HashAlgorithm, HashDigest}; use uv_pypi_types::{HashAlgorithm, HashDigest};
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum HashPolicy<'a> { pub enum HashPolicy<'a> {

View file

@ -1,12 +1,12 @@
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
use std::path::PathBuf; use std::path::PathBuf;
use cache_key::{CanonicalUrl, RepositoryUrl};
use url::Url; use url::Url;
use uv_cache_key::{CanonicalUrl, RepositoryUrl};
use pep440_rs::Version;
use pypi_types::HashDigest;
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pep440::Version;
use uv_pypi_types::HashDigest;
/// A unique identifier for a package. A package can either be identified by a name (e.g., `black`) /// A unique identifier for a package. A package can either be identified by a name (e.g., `black`)
/// or a URL (e.g., `git+https://github.com/psf/black`). /// or a URL (e.g., `git+https://github.com/psf/black`).

View file

@ -9,7 +9,7 @@ use std::sync::{Arc, LazyLock, RwLock};
use thiserror::Error; use thiserror::Error;
use url::{ParseError, Url}; use url::{ParseError, Url};
use pep508_rs::{VerbatimUrl, VerbatimUrlError}; use uv_pep508::{VerbatimUrl, VerbatimUrlError};
use crate::Verbatim; use crate::Verbatim;

View file

@ -7,12 +7,12 @@ use fs_err as fs;
use tracing::warn; use tracing::warn;
use url::Url; use url::Url;
use distribution_filename::EggInfoFilename;
use pep440_rs::Version;
use pypi_types::DirectUrl;
use uv_cache_info::CacheInfo; use uv_cache_info::CacheInfo;
use uv_distribution_filename::EggInfoFilename;
use uv_fs::Simplified; use uv_fs::Simplified;
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pep440::Version;
use uv_pypi_types::DirectUrl;
use crate::{DistributionMetadata, InstalledMetadata, InstalledVersion, Name, VersionOrUrlRef}; use crate::{DistributionMetadata, InstalledMetadata, InstalledVersion, Name, VersionOrUrlRef};
@ -285,13 +285,13 @@ impl InstalledDist {
} }
/// Read the `METADATA` file from a `.dist-info` directory. /// Read the `METADATA` file from a `.dist-info` directory.
pub fn metadata(&self) -> Result<pypi_types::ResolutionMetadata> { pub fn metadata(&self) -> Result<uv_pypi_types::ResolutionMetadata> {
match self { match self {
Self::Registry(_) | Self::Url(_) => { Self::Registry(_) | Self::Url(_) => {
let path = self.path().join("METADATA"); let path = self.path().join("METADATA");
let contents = fs::read(&path)?; let contents = fs::read(&path)?;
// TODO(zanieb): Update this to use thiserror so we can unpack parse errors downstream // TODO(zanieb): Update this to use thiserror so we can unpack parse errors downstream
pypi_types::ResolutionMetadata::parse_metadata(&contents).with_context(|| { uv_pypi_types::ResolutionMetadata::parse_metadata(&contents).with_context(|| {
format!( format!(
"Failed to parse `METADATA` file at: {}", "Failed to parse `METADATA` file at: {}",
path.user_display() path.user_display()
@ -306,7 +306,7 @@ impl InstalledDist {
_ => unreachable!(), _ => unreachable!(),
}; };
let contents = fs::read(path.as_ref())?; let contents = fs::read(path.as_ref())?;
pypi_types::ResolutionMetadata::parse_metadata(&contents).with_context(|| { uv_pypi_types::ResolutionMetadata::parse_metadata(&contents).with_context(|| {
format!( format!(
"Failed to parse `PKG-INFO` file at: {}", "Failed to parse `PKG-INFO` file at: {}",
path.user_display() path.user_display()
@ -447,7 +447,7 @@ impl InstalledMetadata for InstalledDist {
} }
} }
fn read_metadata(path: &Path) -> Option<pypi_types::Metadata10> { fn read_metadata(path: &Path) -> Option<uv_pypi_types::Metadata10> {
let content = match fs::read(path) { let content = match fs::read(path) {
Ok(content) => content, Ok(content) => content,
Err(err) => { Err(err) => {
@ -455,7 +455,7 @@ fn read_metadata(path: &Path) -> Option<pypi_types::Metadata10> {
return None; return None;
} }
}; };
let metadata = match pypi_types::Metadata10::parse_pkg_info(&content) { let metadata = match uv_pypi_types::Metadata10::parse_pkg_info(&content) {
Ok(metadata) => metadata, Ok(metadata) => metadata,
Err(err) => { Err(err) => {
warn!("Failed to parse metadata for {path:?}: {err}"); warn!("Failed to parse metadata for {path:?}: {err}");

View file

@ -39,13 +39,13 @@ use std::str::FromStr;
use url::Url; use url::Url;
use distribution_filename::{DistExtension, SourceDistExtension, WheelFilename}; use uv_distribution_filename::{DistExtension, SourceDistExtension, WheelFilename};
use pep440_rs::Version;
use pep508_rs::{Pep508Url, VerbatimUrl};
use pypi_types::{ParsedUrl, VerbatimParsedUrl};
use uv_fs::normalize_absolute_path; use uv_fs::normalize_absolute_path;
use uv_git::GitUrl; use uv_git::GitUrl;
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pep440::Version;
use uv_pep508::{Pep508Url, VerbatimUrl};
use uv_pypi_types::{ParsedUrl, VerbatimParsedUrl};
pub use crate::annotation::*; pub use crate::annotation::*;
pub use crate::any::*; pub use crate::any::*;
@ -983,11 +983,11 @@ impl RemoteSource for Dist {
impl Identifier for Url { impl Identifier for Url {
fn distribution_id(&self) -> DistributionId { fn distribution_id(&self) -> DistributionId {
DistributionId::Url(cache_key::CanonicalUrl::new(self)) DistributionId::Url(uv_cache_key::CanonicalUrl::new(self))
} }
fn resource_id(&self) -> ResourceId { fn resource_id(&self) -> ResourceId {
ResourceId::Url(cache_key::RepositoryUrl::new(self)) ResourceId::Url(uv_cache_key::RepositoryUrl::new(self))
} }
} }

View file

@ -1,9 +1,9 @@
use distribution_filename::BuildTag;
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
use uv_distribution_filename::BuildTag;
use pep440_rs::VersionSpecifiers; use uv_pep440::VersionSpecifiers;
use platform_tags::{IncompatibleTag, TagPriority}; use uv_platform_tags::{IncompatibleTag, TagPriority};
use pypi_types::{HashDigest, Yanked}; use uv_pypi_types::{HashDigest, Yanked};
use crate::{ use crate::{
InstalledDist, RegistryBuiltDist, RegistryBuiltWheel, RegistrySourceDist, ResolvedDistRef, InstalledDist, RegistryBuiltDist, RegistryBuiltWheel, RegistrySourceDist, ResolvedDistRef,

View file

@ -1,8 +1,8 @@
use distribution_filename::DistExtension;
use pep508_rs::MarkerTree;
use pypi_types::{HashDigest, Requirement, RequirementSource};
use std::collections::BTreeMap; use std::collections::BTreeMap;
use uv_distribution_filename::DistExtension;
use uv_normalize::{ExtraName, GroupName, PackageName}; use uv_normalize::{ExtraName, GroupName, PackageName};
use uv_pep508::MarkerTree;
use uv_pypi_types::{HashDigest, Requirement, RequirementSource};
use crate::{BuiltDist, Diagnostic, Dist, Name, ResolvedDist, SourceDist}; use crate::{BuiltDist, Diagnostic, Dist, Name, ResolvedDist, SourceDist};
@ -185,8 +185,8 @@ impl From<&ResolvedDist> for Requirement {
let source = match resolved_dist { let source = match resolved_dist {
ResolvedDist::Installable(dist) => match dist { ResolvedDist::Installable(dist) => match dist {
Dist::Built(BuiltDist::Registry(wheels)) => RequirementSource::Registry { Dist::Built(BuiltDist::Registry(wheels)) => RequirementSource::Registry {
specifier: pep440_rs::VersionSpecifiers::from( specifier: uv_pep440::VersionSpecifiers::from(
pep440_rs::VersionSpecifier::equals_version( uv_pep440::VersionSpecifier::equals_version(
wheels.best_wheel().filename.version.clone(), wheels.best_wheel().filename.version.clone(),
), ),
), ),
@ -208,8 +208,8 @@ impl From<&ResolvedDist> for Requirement {
ext: DistExtension::Wheel, ext: DistExtension::Wheel,
}, },
Dist::Source(SourceDist::Registry(sdist)) => RequirementSource::Registry { Dist::Source(SourceDist::Registry(sdist)) => RequirementSource::Registry {
specifier: pep440_rs::VersionSpecifiers::from( specifier: uv_pep440::VersionSpecifiers::from(
pep440_rs::VersionSpecifier::equals_version(sdist.version.clone()), uv_pep440::VersionSpecifier::equals_version(sdist.version.clone()),
), ),
index: None, index: None,
}, },
@ -243,8 +243,8 @@ impl From<&ResolvedDist> for Requirement {
}, },
}, },
ResolvedDist::Installed(dist) => RequirementSource::Registry { ResolvedDist::Installed(dist) => RequirementSource::Registry {
specifier: pep440_rs::VersionSpecifiers::from( specifier: uv_pep440::VersionSpecifiers::from(
pep440_rs::VersionSpecifier::equals_version(dist.version().clone()), uv_pep440::VersionSpecifier::equals_version(dist.version().clone()),
), ),
index: None, index: None,
}, },

View file

@ -1,7 +1,7 @@
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
use pep508_rs::PackageName; use uv_pep508::PackageName;
use pypi_types::Yanked; use uv_pypi_types::Yanked;
use crate::{ use crate::{
BuiltDist, Dist, DistributionId, DistributionMetadata, Identifier, IndexUrl, InstalledDist, BuiltDist, Dist, DistributionId, DistributionMetadata, Identifier, IndexUrl, InstalledDist,

View file

@ -1,9 +1,9 @@
use std::borrow::Cow; use std::borrow::Cow;
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
use pep508_rs::{MarkerEnvironment, UnnamedRequirement};
use pypi_types::{Hashes, ParsedUrl, Requirement, RequirementSource};
use uv_normalize::ExtraName; use uv_normalize::ExtraName;
use uv_pep508::{MarkerEnvironment, UnnamedRequirement};
use uv_pypi_types::{Hashes, ParsedUrl, Requirement, RequirementSource};
use crate::VerbatimParsedUrl; use crate::VerbatimParsedUrl;
@ -33,7 +33,7 @@ pub struct UnresolvedRequirementSpecification {
/// resolve the requirement name. /// resolve the requirement name.
/// ///
/// Analog to `RequirementsTxtRequirement` but with `distribution_types::Requirement` instead of /// Analog to `RequirementsTxtRequirement` but with `distribution_types::Requirement` instead of
/// `pep508_rs::Requirement`. /// `uv_pep508::Requirement`.
#[derive(Hash, Debug, Clone, Eq, PartialEq)] #[derive(Hash, Debug, Clone, Eq, PartialEq)]
pub enum UnresolvedRequirement { pub enum UnresolvedRequirement {
/// The uv-specific superset over PEP 508 requirements specifier incorporating /// The uv-specific superset over PEP 508 requirements specifier incorporating

View file

@ -1,7 +1,7 @@
use std::borrow::Cow; use std::borrow::Cow;
use pep508_rs::VerbatimUrl;
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pep508::VerbatimUrl;
use crate::error::Error; use crate::error::Error;
use crate::{ use crate::{
@ -20,7 +20,7 @@ pub trait Name {
/// Metadata that can be resolved from a requirements specification alone (i.e., prior to building /// Metadata that can be resolved from a requirements specification alone (i.e., prior to building
/// or installing the distribution). /// or installing the distribution).
pub trait DistributionMetadata: Name { pub trait DistributionMetadata: Name {
/// Return a [`pep440_rs::Version`], for registry-based distributions, or a [`url::Url`], /// Return a [`uv_pep440::Version`], for registry-based distributions, or a [`url::Url`],
/// for URL-based distributions. /// for URL-based distributions.
fn version_or_url(&self) -> VersionOrUrlRef; fn version_or_url(&self) -> VersionOrUrlRef;

View file

@ -13,22 +13,22 @@ license = { workspace = true }
workspace = true workspace = true
[dependencies] [dependencies]
cache-key = { workspace = true }
distribution-filename = { workspace = true }
distribution-types = { workspace = true }
pep440_rs = { workspace = true }
pep508_rs = { workspace = true }
platform-tags = { workspace = true }
pypi-types = { workspace = true }
uv-cache = { workspace = true } uv-cache = { workspace = true }
uv-cache-info = { workspace = true } uv-cache-info = { workspace = true }
uv-cache-key = { workspace = true }
uv-client = { workspace = true } uv-client = { workspace = true }
uv-configuration = { workspace = true } uv-configuration = { workspace = true }
uv-distribution-filename = { workspace = true }
uv-distribution-types = { workspace = true }
uv-extract = { workspace = true } uv-extract = { workspace = true }
uv-fs = { workspace = true, features = ["tokio"] } uv-fs = { workspace = true, features = ["tokio"] }
uv-git = { workspace = true } uv-git = { workspace = true }
uv-metadata = { workspace = true } uv-metadata = { workspace = true }
uv-normalize = { workspace = true } uv-normalize = { workspace = true }
uv-pep440 = { workspace = true }
uv-pep508 = { workspace = true }
uv-platform-tags = { workspace = true }
uv-pypi-types = { workspace = true }
uv-types = { workspace = true } uv-types = { workspace = true }
uv-warnings = { workspace = true } uv-warnings = { workspace = true }
uv-workspace = { workspace = true } uv-workspace = { workspace = true }

View file

@ -1,6 +1,6 @@
use distribution_types::Hashed;
use pypi_types::HashDigest;
use uv_cache::{ArchiveId, Cache}; use uv_cache::{ArchiveId, Cache};
use uv_distribution_types::Hashed;
use uv_pypi_types::HashDigest;
/// An archive (unzipped wheel) that exists in the local cache. /// An archive (unzipped wheel) that exists in the local cache.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]

View file

@ -14,19 +14,19 @@ use tokio_util::compat::FuturesAsyncReadCompatExt;
use tracing::{debug, info_span, instrument, warn, Instrument}; use tracing::{debug, info_span, instrument, warn, Instrument};
use url::Url; use url::Url;
use distribution_filename::WheelFilename;
use distribution_types::{
BuildableSource, BuiltDist, Dist, FileLocation, HashPolicy, Hashed, Name, SourceDist,
};
use platform_tags::Tags;
use pypi_types::HashDigest;
use uv_cache::{ArchiveId, CacheBucket, CacheEntry, WheelCache}; use uv_cache::{ArchiveId, CacheBucket, CacheEntry, WheelCache};
use uv_cache_info::{CacheInfo, Timestamp}; use uv_cache_info::{CacheInfo, Timestamp};
use uv_client::{ use uv_client::{
CacheControl, CachedClientError, Connectivity, DataWithCachePolicy, RegistryClient, CacheControl, CachedClientError, Connectivity, DataWithCachePolicy, RegistryClient,
}; };
use uv_distribution_filename::WheelFilename;
use uv_distribution_types::{
BuildableSource, BuiltDist, Dist, FileLocation, HashPolicy, Hashed, Name, SourceDist,
};
use uv_extract::hash::Hasher; use uv_extract::hash::Hasher;
use uv_fs::write_atomic; use uv_fs::write_atomic;
use uv_platform_tags::Tags;
use uv_pypi_types::HashDigest;
use uv_types::BuildContext; use uv_types::BuildContext;
use crate::archive::Archive; use crate::archive::Archive;
@ -148,7 +148,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
let wheel = wheels.best_wheel(); let wheel = wheels.best_wheel();
let url = match &wheel.file.url { let url = match &wheel.file.url {
FileLocation::RelativeUrl(base, url) => { FileLocation::RelativeUrl(base, url) => {
pypi_types::base_url_join_relative(base, url)? uv_pypi_types::base_url_join_relative(base, url)?
} }
FileLocation::AbsoluteUrl(url) => url.to_url(), FileLocation::AbsoluteUrl(url) => url.to_url(),
}; };

View file

@ -1,10 +1,10 @@
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use crate::Error; use crate::Error;
use distribution_filename::WheelFilename; use uv_distribution_filename::WheelFilename;
use distribution_types::{CachedDist, Dist, Hashed}; use uv_distribution_types::{CachedDist, Dist, Hashed};
use pypi_types::{HashDigest, ResolutionMetadata};
use uv_metadata::read_flat_wheel_metadata; use uv_metadata::read_flat_wheel_metadata;
use uv_pypi_types::{HashDigest, ResolutionMetadata};
use uv_cache_info::CacheInfo; use uv_cache_info::CacheInfo;

View file

@ -6,12 +6,12 @@ use url::Url;
use zip::result::ZipError; use zip::result::ZipError;
use crate::metadata::MetadataError; use crate::metadata::MetadataError;
use distribution_filename::WheelFilenameError;
use pep440_rs::Version;
use pypi_types::{HashDigest, ParsedUrlError};
use uv_client::WrappedReqwestError; use uv_client::WrappedReqwestError;
use uv_distribution_filename::WheelFilenameError;
use uv_fs::Simplified; use uv_fs::Simplified;
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pep440::Version;
use uv_pypi_types::{HashDigest, ParsedUrlError};
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
pub enum Error { pub enum Error {
@ -26,7 +26,7 @@ pub enum Error {
#[error(transparent)] #[error(transparent)]
ParsedUrl(#[from] ParsedUrlError), ParsedUrl(#[from] ParsedUrlError),
#[error(transparent)] #[error(transparent)]
JoinRelativeUrl(#[from] pypi_types::JoinRelativeError), JoinRelativeUrl(#[from] uv_pypi_types::JoinRelativeError),
#[error("Expected a file URL, but received: {0}")] #[error("Expected a file URL, but received: {0}")]
NonFileUrl(Url), NonFileUrl(Url),
#[error(transparent)] #[error(transparent)]
@ -65,7 +65,7 @@ pub enum Error {
#[error("Package metadata version `{metadata}` does not match given version `{given}`")] #[error("Package metadata version `{metadata}` does not match given version `{given}`")]
VersionMismatch { given: Version, metadata: Version }, VersionMismatch { given: Version, metadata: Version },
#[error("Failed to parse metadata from built wheel")] #[error("Failed to parse metadata from built wheel")]
Metadata(#[from] pypi_types::MetadataError), Metadata(#[from] uv_pypi_types::MetadataError),
#[error("Failed to read metadata: `{}`", _0.user_display())] #[error("Failed to read metadata: `{}`", _0.user_display())]
WheelMetadata(PathBuf, #[source] Box<uv_metadata::Error>), WheelMetadata(PathBuf, #[source] Box<uv_metadata::Error>),
#[error("Failed to read zip archive from built wheel")] #[error("Failed to read zip archive from built wheel")]
@ -81,13 +81,13 @@ pub enum Error {
#[error("The source distribution is missing a `requires.txt` file")] #[error("The source distribution is missing a `requires.txt` file")]
MissingRequiresTxt, MissingRequiresTxt,
#[error("Failed to extract static metadata from `PKG-INFO`")] #[error("Failed to extract static metadata from `PKG-INFO`")]
PkgInfo(#[source] pypi_types::MetadataError), PkgInfo(#[source] uv_pypi_types::MetadataError),
#[error("Failed to extract metadata from `requires.txt`")] #[error("Failed to extract metadata from `requires.txt`")]
RequiresTxt(#[source] pypi_types::MetadataError), RequiresTxt(#[source] uv_pypi_types::MetadataError),
#[error("The source distribution is missing a `pyproject.toml` file")] #[error("The source distribution is missing a `pyproject.toml` file")]
MissingPyprojectToml, MissingPyprojectToml,
#[error("Failed to extract static metadata from `pyproject.toml`")] #[error("Failed to extract static metadata from `pyproject.toml`")]
PyprojectToml(#[source] pypi_types::MetadataError), PyprojectToml(#[source] uv_pypi_types::MetadataError),
#[error("Unsupported scheme in URL: {0}")] #[error("Unsupported scheme in URL: {0}")]
UnsupportedScheme(String), UnsupportedScheme(String),
#[error(transparent)] #[error(transparent)]

View file

@ -1,14 +1,15 @@
use crate::index::cached_wheel::CachedWheel; use crate::index::cached_wheel::CachedWheel;
use crate::source::{HttpRevisionPointer, LocalRevisionPointer, HTTP_REVISION, LOCAL_REVISION}; use crate::source::{HttpRevisionPointer, LocalRevisionPointer, HTTP_REVISION, LOCAL_REVISION};
use crate::Error; use crate::Error;
use distribution_types::{
DirectUrlSourceDist, DirectorySourceDist, GitSourceDist, Hashed, PathSourceDist,
};
use platform_tags::Tags;
use uv_cache::{Cache, CacheBucket, CacheShard, WheelCache}; use uv_cache::{Cache, CacheBucket, CacheShard, WheelCache};
use uv_cache_info::CacheInfo; use uv_cache_info::CacheInfo;
use uv_cache_key::cache_digest;
use uv_configuration::ConfigSettings; use uv_configuration::ConfigSettings;
use uv_distribution_types::{
DirectUrlSourceDist, DirectorySourceDist, GitSourceDist, Hashed, PathSourceDist,
};
use uv_fs::symlinks; use uv_fs::symlinks;
use uv_platform_tags::Tags;
use uv_types::HashStrategy; use uv_types::HashStrategy;
/// A local index of built distributions for a specific source distribution. /// A local index of built distributions for a specific source distribution.
@ -65,7 +66,7 @@ impl<'a> BuiltWheelIndex<'a> {
let cache_shard = if self.build_configuration.is_empty() { let cache_shard = if self.build_configuration.is_empty() {
cache_shard cache_shard
} else { } else {
cache_shard.shard(cache_key::cache_digest(self.build_configuration)) cache_shard.shard(cache_digest(self.build_configuration))
}; };
Ok(self.find(&cache_shard)) Ok(self.find(&cache_shard))
@ -102,7 +103,7 @@ impl<'a> BuiltWheelIndex<'a> {
let cache_shard = if self.build_configuration.is_empty() { let cache_shard = if self.build_configuration.is_empty() {
cache_shard cache_shard
} else { } else {
cache_shard.shard(cache_key::cache_digest(self.build_configuration)) cache_shard.shard(cache_digest(self.build_configuration))
}; };
Ok(self Ok(self
@ -150,7 +151,7 @@ impl<'a> BuiltWheelIndex<'a> {
let cache_shard = if self.build_configuration.is_empty() { let cache_shard = if self.build_configuration.is_empty() {
cache_shard cache_shard
} else { } else {
cache_shard.shard(cache_key::cache_digest(self.build_configuration)) cache_shard.shard(cache_digest(self.build_configuration))
}; };
Ok(self Ok(self
@ -176,7 +177,7 @@ impl<'a> BuiltWheelIndex<'a> {
let cache_shard = if self.build_configuration.is_empty() { let cache_shard = if self.build_configuration.is_empty() {
cache_shard cache_shard
} else { } else {
cache_shard.shard(cache_key::cache_digest(self.build_configuration)) cache_shard.shard(cache_digest(self.build_configuration))
}; };
self.find(&cache_shard) self.find(&cache_shard)

View file

@ -2,12 +2,12 @@ use std::path::Path;
use crate::archive::Archive; use crate::archive::Archive;
use crate::{HttpArchivePointer, LocalArchivePointer}; use crate::{HttpArchivePointer, LocalArchivePointer};
use distribution_filename::WheelFilename;
use distribution_types::{CachedDirectUrlDist, CachedRegistryDist, Hashed};
use pep508_rs::VerbatimUrl;
use pypi_types::HashDigest;
use uv_cache::{Cache, CacheBucket, CacheEntry}; use uv_cache::{Cache, CacheBucket, CacheEntry};
use uv_cache_info::CacheInfo; use uv_cache_info::CacheInfo;
use uv_distribution_filename::WheelFilename;
use uv_distribution_types::{CachedDirectUrlDist, CachedRegistryDist, Hashed};
use uv_pep508::VerbatimUrl;
use uv_pypi_types::HashDigest;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct CachedWheel { pub struct CachedWheel {

View file

@ -2,11 +2,11 @@ use std::collections::hash_map::Entry;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use distribution_types::{CachedRegistryDist, Hashed, IndexLocations, IndexUrl};
use platform_tags::Tags;
use uv_cache::{Cache, CacheBucket, WheelCache}; use uv_cache::{Cache, CacheBucket, WheelCache};
use uv_distribution_types::{CachedRegistryDist, Hashed, IndexLocations, IndexUrl};
use uv_fs::{directories, files, symlinks}; use uv_fs::{directories, files, symlinks};
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_platform_tags::Tags;
use uv_types::HashStrategy; use uv_types::HashStrategy;
use crate::index::cached_wheel::CachedWheel; use crate::index::cached_wheel::CachedWheel;

View file

@ -3,7 +3,7 @@ use std::rc::Rc;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use tokio::sync::Mutex; use tokio::sync::Mutex;
use distribution_types::{Identifier, ResourceId}; use uv_distribution_types::{Identifier, ResourceId};
/// A set of locks used to prevent concurrent access to the same resource. /// A set of locks used to prevent concurrent access to the same resource.
#[derive(Debug, Default)] #[derive(Debug, Default)]

View file

@ -5,12 +5,12 @@ use std::path::{Path, PathBuf};
use thiserror::Error; use thiserror::Error;
use url::Url; use url::Url;
use distribution_filename::DistExtension; use uv_distribution_filename::DistExtension;
use pep440_rs::VersionSpecifiers;
use pep508_rs::{MarkerTree, VerbatimUrl, VersionOrUrl};
use pypi_types::{ParsedUrlError, Requirement, RequirementSource, VerbatimParsedUrl};
use uv_git::GitReference; use uv_git::GitReference;
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pep440::VersionSpecifiers;
use uv_pep508::{MarkerTree, VerbatimUrl, VersionOrUrl};
use uv_pypi_types::{ParsedUrlError, Requirement, RequirementSource, VerbatimParsedUrl};
use uv_warnings::warn_user_once; use uv_warnings::warn_user_once;
use uv_workspace::pyproject::{PyProjectToml, Source, Sources}; use uv_workspace::pyproject::{PyProjectToml, Source, Sources};
use uv_workspace::Workspace; use uv_workspace::Workspace;
@ -29,7 +29,7 @@ enum Origin {
impl LoweredRequirement { impl LoweredRequirement {
/// Combine `project.dependencies` or `project.optional-dependencies` with `tool.uv.sources`. /// Combine `project.dependencies` or `project.optional-dependencies` with `tool.uv.sources`.
pub(crate) fn from_requirement<'data>( pub(crate) fn from_requirement<'data>(
requirement: pep508_rs::Requirement<VerbatimParsedUrl>, requirement: uv_pep508::Requirement<VerbatimParsedUrl>,
project_name: &'data PackageName, project_name: &'data PackageName,
project_dir: &'data Path, project_dir: &'data Path,
project_sources: &'data BTreeMap<PackageName, Sources>, project_sources: &'data BTreeMap<PackageName, Sources>,
@ -229,10 +229,10 @@ impl LoweredRequirement {
) )
} }
/// Lower a [`pep508_rs::Requirement`] in a non-workspace setting (for example, in a PEP 723 /// Lower a [`uv_pep508::Requirement`] in a non-workspace setting (for example, in a PEP 723
/// script, which runs in an isolated context). /// script, which runs in an isolated context).
pub fn from_non_workspace_requirement<'data>( pub fn from_non_workspace_requirement<'data>(
requirement: pep508_rs::Requirement<VerbatimParsedUrl>, requirement: uv_pep508::Requirement<VerbatimParsedUrl>,
dir: &'data Path, dir: &'data Path,
sources: &'data BTreeMap<PackageName, Sources>, sources: &'data BTreeMap<PackageName, Sources>,
) -> impl Iterator<Item = Result<LoweredRequirement, LoweringError>> + 'data { ) -> impl Iterator<Item = Result<LoweredRequirement, LoweringError>> + 'data {
@ -360,7 +360,7 @@ pub enum LoweringError {
#[error(transparent)] #[error(transparent)]
InvalidUrl(#[from] url::ParseError), InvalidUrl(#[from] url::ParseError),
#[error(transparent)] #[error(transparent)]
InvalidVerbatimUrl(#[from] pep508_rs::VerbatimUrlError), InvalidVerbatimUrl(#[from] uv_pep508::VerbatimUrlError),
#[error("Can't combine URLs from both `project.dependencies` and `tool.uv.sources`")] #[error("Can't combine URLs from both `project.dependencies` and `tool.uv.sources`")]
ConflictingUrls, ConflictingUrls,
#[error("Fragments are not allowed in URLs: `{0}`")] #[error("Fragments are not allowed in URLs: `{0}`")]
@ -444,7 +444,7 @@ fn url_source(url: Url, subdirectory: Option<PathBuf>) -> Result<RequirementSour
/// Convert a registry source into a [`RequirementSource`]. /// Convert a registry source into a [`RequirementSource`].
fn registry_source( fn registry_source(
requirement: &pep508_rs::Requirement<VerbatimParsedUrl>, requirement: &uv_pep508::Requirement<VerbatimParsedUrl>,
index: String, index: String,
) -> Result<RequirementSource, LoweringError> { ) -> Result<RequirementSource, LoweringError> {
match &requirement.version_or_url { match &requirement.version_or_url {

View file

@ -3,10 +3,10 @@ use std::path::Path;
use thiserror::Error; use thiserror::Error;
use pep440_rs::{Version, VersionSpecifiers};
use pypi_types::{HashDigest, ResolutionMetadata};
use uv_configuration::SourceStrategy; use uv_configuration::SourceStrategy;
use uv_normalize::{ExtraName, GroupName, PackageName}; use uv_normalize::{ExtraName, GroupName, PackageName};
use uv_pep440::{Version, VersionSpecifiers};
use uv_pypi_types::{HashDigest, ResolutionMetadata};
use uv_workspace::WorkspaceError; use uv_workspace::WorkspaceError;
pub use crate::metadata::lowering::LoweredRequirement; pub use crate::metadata::lowering::LoweredRequirement;
@ -32,10 +32,10 @@ pub struct Metadata {
pub name: PackageName, pub name: PackageName,
pub version: Version, pub version: Version,
// Optional fields // Optional fields
pub requires_dist: Vec<pypi_types::Requirement>, pub requires_dist: Vec<uv_pypi_types::Requirement>,
pub requires_python: Option<VersionSpecifiers>, pub requires_python: Option<VersionSpecifiers>,
pub provides_extras: Vec<ExtraName>, pub provides_extras: Vec<ExtraName>,
pub dev_dependencies: BTreeMap<GroupName, Vec<pypi_types::Requirement>>, pub dev_dependencies: BTreeMap<GroupName, Vec<uv_pypi_types::Requirement>>,
} }
impl Metadata { impl Metadata {
@ -48,7 +48,7 @@ impl Metadata {
requires_dist: metadata requires_dist: metadata
.requires_dist .requires_dist
.into_iter() .into_iter()
.map(pypi_types::Requirement::from) .map(uv_pypi_types::Requirement::from)
.collect(), .collect(),
requires_python: metadata.requires_python, requires_python: metadata.requires_python,
provides_extras: metadata.provides_extras, provides_extras: metadata.provides_extras,
@ -70,7 +70,7 @@ impl Metadata {
provides_extras, provides_extras,
dev_dependencies, dev_dependencies,
} = RequiresDist::from_project_maybe_workspace( } = RequiresDist::from_project_maybe_workspace(
pypi_types::RequiresDist { uv_pypi_types::RequiresDist {
name: metadata.name, name: metadata.name,
requires_dist: metadata.requires_dist, requires_dist: metadata.requires_dist,
provides_extras: metadata.provides_extras, provides_extras: metadata.provides_extras,

View file

@ -11,21 +11,21 @@ use uv_workspace::{DiscoveryOptions, ProjectWorkspace};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct RequiresDist { pub struct RequiresDist {
pub name: PackageName, pub name: PackageName,
pub requires_dist: Vec<pypi_types::Requirement>, pub requires_dist: Vec<uv_pypi_types::Requirement>,
pub provides_extras: Vec<ExtraName>, pub provides_extras: Vec<ExtraName>,
pub dev_dependencies: BTreeMap<GroupName, Vec<pypi_types::Requirement>>, pub dev_dependencies: BTreeMap<GroupName, Vec<uv_pypi_types::Requirement>>,
} }
impl RequiresDist { impl RequiresDist {
/// Lower without considering `tool.uv` in `pyproject.toml`, used for index and other archive /// Lower without considering `tool.uv` in `pyproject.toml`, used for index and other archive
/// dependencies. /// dependencies.
pub fn from_metadata23(metadata: pypi_types::RequiresDist) -> Self { pub fn from_metadata23(metadata: uv_pypi_types::RequiresDist) -> Self {
Self { Self {
name: metadata.name, name: metadata.name,
requires_dist: metadata requires_dist: metadata
.requires_dist .requires_dist
.into_iter() .into_iter()
.map(pypi_types::Requirement::from) .map(uv_pypi_types::Requirement::from)
.collect(), .collect(),
provides_extras: metadata.provides_extras, provides_extras: metadata.provides_extras,
dev_dependencies: BTreeMap::default(), dev_dependencies: BTreeMap::default(),
@ -35,7 +35,7 @@ impl RequiresDist {
/// Lower by considering `tool.uv` in `pyproject.toml` if present, used for Git and directory /// Lower by considering `tool.uv` in `pyproject.toml` if present, used for Git and directory
/// dependencies. /// dependencies.
pub async fn from_project_maybe_workspace( pub async fn from_project_maybe_workspace(
metadata: pypi_types::RequiresDist, metadata: uv_pypi_types::RequiresDist,
install_path: &Path, install_path: &Path,
sources: SourceStrategy, sources: SourceStrategy,
) -> Result<Self, MetadataError> { ) -> Result<Self, MetadataError> {
@ -52,7 +52,7 @@ impl RequiresDist {
} }
fn from_project_workspace( fn from_project_workspace(
metadata: pypi_types::RequiresDist, metadata: uv_pypi_types::RequiresDist,
project_workspace: &ProjectWorkspace, project_workspace: &ProjectWorkspace,
source_strategy: SourceStrategy, source_strategy: SourceStrategy,
) -> Result<Self, MetadataError> { ) -> Result<Self, MetadataError> {
@ -103,7 +103,7 @@ impl RequiresDist {
.collect::<Result<Vec<_>, _>>()?, .collect::<Result<Vec<_>, _>>()?,
SourceStrategy::Disabled => dev_dependencies SourceStrategy::Disabled => dev_dependencies
.into_iter() .into_iter()
.map(pypi_types::Requirement::from) .map(uv_pypi_types::Requirement::from)
.collect(), .collect(),
}; };
if dev_dependencies.is_empty() { if dev_dependencies.is_empty() {
@ -135,7 +135,7 @@ impl RequiresDist {
.collect::<Result<Vec<_>, _>>()?, .collect::<Result<Vec<_>, _>>()?,
SourceStrategy::Disabled => requires_dist SourceStrategy::Disabled => requires_dist
.into_iter() .into_iter()
.map(pypi_types::Requirement::from) .map(uv_pypi_types::Requirement::from)
.collect(), .collect(),
}; };
@ -188,7 +188,7 @@ mod test {
}, },
) )
.await?; .await?;
let requires_dist = pypi_types::RequiresDist::parse_pyproject_toml(contents)?; let requires_dist = uv_pypi_types::RequiresDist::parse_pyproject_toml(contents)?;
Ok(RequiresDist::from_project_workspace( Ok(RequiresDist::from_project_workspace(
requires_dist, requires_dist,
&project_workspace, &project_workspace,

View file

@ -2,8 +2,8 @@ use std::sync::Arc;
use url::Url; use url::Url;
use distribution_types::BuildableSource; use uv_distribution_types::BuildableSource;
use pep508_rs::PackageName; use uv_pep508::PackageName;
pub trait Reporter: Send + Sync { pub trait Reporter: Send + Sync {
/// Callback to invoke when a source distribution build is kicked off. /// Callback to invoke when a source distribution build is kicked off.

View file

@ -1,13 +1,13 @@
use std::path::PathBuf; use std::path::PathBuf;
use std::str::FromStr; use std::str::FromStr;
use distribution_filename::WheelFilename;
use distribution_types::Hashed;
use platform_tags::Tags;
use pypi_types::HashDigest;
use uv_cache::CacheShard; use uv_cache::CacheShard;
use uv_cache_info::CacheInfo; use uv_cache_info::CacheInfo;
use uv_distribution_filename::WheelFilename;
use uv_distribution_types::Hashed;
use uv_fs::files; use uv_fs::files;
use uv_platform_tags::Tags;
use uv_pypi_types::HashDigest;
/// The information about the wheel we either just built or got from the cache. /// The information about the wheel we either just built or got from the cache.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]

View file

@ -12,28 +12,29 @@ use crate::reporter::Facade;
use crate::source::built_wheel_metadata::BuiltWheelMetadata; use crate::source::built_wheel_metadata::BuiltWheelMetadata;
use crate::source::revision::Revision; use crate::source::revision::Revision;
use crate::{Reporter, RequiresDist}; use crate::{Reporter, RequiresDist};
use distribution_filename::{SourceDistExtension, WheelFilename};
use distribution_types::{
BuildableSource, DirectorySourceUrl, FileLocation, GitSourceUrl, HashPolicy, Hashed,
PathSourceUrl, RemoteSource, SourceDist, SourceUrl,
};
use fs_err::tokio as fs; use fs_err::tokio as fs;
use futures::{FutureExt, TryStreamExt}; use futures::{FutureExt, TryStreamExt};
use platform_tags::Tags;
use pypi_types::{HashDigest, Metadata12, RequiresTxt, ResolutionMetadata};
use reqwest::Response; use reqwest::Response;
use tokio_util::compat::FuturesAsyncReadCompatExt; use tokio_util::compat::FuturesAsyncReadCompatExt;
use tracing::{debug, info_span, instrument, warn, Instrument}; use tracing::{debug, info_span, instrument, warn, Instrument};
use url::Url; use url::Url;
use uv_cache::{Cache, CacheBucket, CacheEntry, CacheShard, Removal, WheelCache}; use uv_cache::{Cache, CacheBucket, CacheEntry, CacheShard, Removal, WheelCache};
use uv_cache_info::CacheInfo; use uv_cache_info::CacheInfo;
use uv_cache_key::cache_digest;
use uv_client::{ use uv_client::{
CacheControl, CachedClientError, Connectivity, DataWithCachePolicy, RegistryClient, CacheControl, CachedClientError, Connectivity, DataWithCachePolicy, RegistryClient,
}; };
use uv_configuration::{BuildKind, BuildOutput}; use uv_configuration::{BuildKind, BuildOutput};
use uv_distribution_filename::{SourceDistExtension, WheelFilename};
use uv_distribution_types::{
BuildableSource, DirectorySourceUrl, FileLocation, GitSourceUrl, HashPolicy, Hashed,
PathSourceUrl, RemoteSource, SourceDist, SourceUrl,
};
use uv_extract::hash::Hasher; use uv_extract::hash::Hasher;
use uv_fs::{rename_with_retry, write_atomic, LockedFile}; use uv_fs::{rename_with_retry, write_atomic, LockedFile};
use uv_metadata::read_archive_metadata; use uv_metadata::read_archive_metadata;
use uv_platform_tags::Tags;
use uv_pypi_types::{HashDigest, Metadata12, RequiresTxt, ResolutionMetadata};
use uv_types::{BuildContext, SourceBuildTrait}; use uv_types::{BuildContext, SourceBuildTrait};
use zip::ZipArchive; use zip::ZipArchive;
@ -94,7 +95,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
let url = match &dist.file.url { let url = match &dist.file.url {
FileLocation::RelativeUrl(base, url) => { FileLocation::RelativeUrl(base, url) => {
pypi_types::base_url_join_relative(base, url)? uv_pypi_types::base_url_join_relative(base, url)?
} }
FileLocation::AbsoluteUrl(url) => url.to_url(), FileLocation::AbsoluteUrl(url) => url.to_url(),
}; };
@ -253,7 +254,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
let url = match &dist.file.url { let url = match &dist.file.url {
FileLocation::RelativeUrl(base, url) => { FileLocation::RelativeUrl(base, url) => {
pypi_types::base_url_join_relative(base, url)? uv_pypi_types::base_url_join_relative(base, url)?
} }
FileLocation::AbsoluteUrl(url) => url.to_url(), FileLocation::AbsoluteUrl(url) => url.to_url(),
}; };
@ -432,7 +433,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
let cache_shard = if config_settings.is_empty() { let cache_shard = if config_settings.is_empty() {
cache_shard cache_shard
} else { } else {
cache_shard.shard(cache_key::cache_digest(config_settings)) cache_shard.shard(cache_digest(config_settings))
}; };
// If the cache contains a compatible wheel, return it. // If the cache contains a compatible wheel, return it.
@ -566,7 +567,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
let cache_shard = if config_settings.is_empty() { let cache_shard = if config_settings.is_empty() {
cache_shard cache_shard
} else { } else {
cache_shard.shard(cache_key::cache_digest(config_settings)) cache_shard.shard(cache_digest(config_settings))
}; };
// Otherwise, we either need to build the metadata. // Otherwise, we either need to build the metadata.
@ -727,7 +728,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
let cache_shard = if config_settings.is_empty() { let cache_shard = if config_settings.is_empty() {
cache_shard cache_shard
} else { } else {
cache_shard.shard(cache_key::cache_digest(config_settings)) cache_shard.shard(cache_digest(config_settings))
}; };
// If the cache contains a compatible wheel, return it. // If the cache contains a compatible wheel, return it.
@ -858,7 +859,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
let cache_shard = if config_settings.is_empty() { let cache_shard = if config_settings.is_empty() {
cache_shard cache_shard
} else { } else {
cache_shard.shard(cache_key::cache_digest(config_settings)) cache_shard.shard(cache_digest(config_settings))
}; };
// Otherwise, we need to build a wheel. // Otherwise, we need to build a wheel.
@ -982,7 +983,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
let cache_shard = if config_settings.is_empty() { let cache_shard = if config_settings.is_empty() {
cache_shard cache_shard
} else { } else {
cache_shard.shard(cache_key::cache_digest(config_settings)) cache_shard.shard(cache_digest(config_settings))
}; };
// If the cache contains a compatible wheel, return it. // If the cache contains a compatible wheel, return it.
@ -1113,7 +1114,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
let cache_shard = if config_settings.is_empty() { let cache_shard = if config_settings.is_empty() {
cache_shard cache_shard
} else { } else {
cache_shard.shard(cache_key::cache_digest(config_settings)) cache_shard.shard(cache_digest(config_settings))
}; };
// Otherwise, we need to build a wheel. // Otherwise, we need to build a wheel.
@ -1231,7 +1232,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
let cache_shard = if config_settings.is_empty() { let cache_shard = if config_settings.is_empty() {
cache_shard cache_shard
} else { } else {
cache_shard.shard(cache_key::cache_digest(config_settings)) cache_shard.shard(cache_digest(config_settings))
}; };
// If the cache contains a compatible wheel, return it. // If the cache contains a compatible wheel, return it.
@ -1365,7 +1366,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
let cache_shard = if config_settings.is_empty() { let cache_shard = if config_settings.is_empty() {
cache_shard cache_shard
} else { } else {
cache_shard.shard(cache_key::cache_digest(config_settings)) cache_shard.shard(cache_digest(config_settings))
}; };
// Otherwise, we need to build a wheel. // Otherwise, we need to build a wheel.
@ -1699,10 +1700,10 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
Err( Err(
err @ (Error::MissingPyprojectToml err @ (Error::MissingPyprojectToml
| Error::PyprojectToml( | Error::PyprojectToml(
pypi_types::MetadataError::Pep508Error(_) uv_pypi_types::MetadataError::Pep508Error(_)
| pypi_types::MetadataError::DynamicField(_) | uv_pypi_types::MetadataError::DynamicField(_)
| pypi_types::MetadataError::FieldNotFound(_) | uv_pypi_types::MetadataError::FieldNotFound(_)
| pypi_types::MetadataError::PoetrySyntax, | uv_pypi_types::MetadataError::PoetrySyntax,
)), )),
) => { ) => {
debug!("No static `pyproject.toml` available for: {source} ({err:?})"); debug!("No static `pyproject.toml` available for: {source} ({err:?})");
@ -1729,10 +1730,10 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
Err( Err(
err @ (Error::MissingPkgInfo err @ (Error::MissingPkgInfo
| Error::PkgInfo( | Error::PkgInfo(
pypi_types::MetadataError::Pep508Error(_) uv_pypi_types::MetadataError::Pep508Error(_)
| pypi_types::MetadataError::DynamicField(_) | uv_pypi_types::MetadataError::DynamicField(_)
| pypi_types::MetadataError::FieldNotFound(_) | uv_pypi_types::MetadataError::FieldNotFound(_)
| pypi_types::MetadataError::UnsupportedMetadataVersion(_), | uv_pypi_types::MetadataError::UnsupportedMetadataVersion(_),
)), )),
) => { ) => {
debug!("No static `PKG-INFO` available for: {source} ({err:?})"); debug!("No static `PKG-INFO` available for: {source} ({err:?})");
@ -1755,14 +1756,14 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
| Error::MissingRequiresTxt | Error::MissingRequiresTxt
| Error::MissingPkgInfo | Error::MissingPkgInfo
| Error::RequiresTxt( | Error::RequiresTxt(
pypi_types::MetadataError::Pep508Error(_) uv_pypi_types::MetadataError::Pep508Error(_)
| pypi_types::MetadataError::RequiresTxtContents(_), | uv_pypi_types::MetadataError::RequiresTxtContents(_),
) )
| Error::PkgInfo( | Error::PkgInfo(
pypi_types::MetadataError::Pep508Error(_) uv_pypi_types::MetadataError::Pep508Error(_)
| pypi_types::MetadataError::DynamicField(_) | uv_pypi_types::MetadataError::DynamicField(_)
| pypi_types::MetadataError::FieldNotFound(_) | uv_pypi_types::MetadataError::FieldNotFound(_)
| pypi_types::MetadataError::UnsupportedMetadataVersion(_), | uv_pypi_types::MetadataError::UnsupportedMetadataVersion(_),
)), )),
) => { ) => {
debug!("No static `egg-info` available for: {source} ({err:?})"); debug!("No static `egg-info` available for: {source} ({err:?})");
@ -2110,7 +2111,7 @@ async fn read_pyproject_toml(
} }
/// Return the [`pypi_types::RequiresDist`] from a `pyproject.toml`, if it can be statically extracted. /// Return the [`pypi_types::RequiresDist`] from a `pyproject.toml`, if it can be statically extracted.
async fn read_requires_dist(project_root: &Path) -> Result<pypi_types::RequiresDist, Error> { async fn read_requires_dist(project_root: &Path) -> Result<uv_pypi_types::RequiresDist, Error> {
// Read the `pyproject.toml` file. // Read the `pyproject.toml` file.
let pyproject_toml = project_root.join("pyproject.toml"); let pyproject_toml = project_root.join("pyproject.toml");
let content = match fs::read_to_string(pyproject_toml).await { let content = match fs::read_to_string(pyproject_toml).await {
@ -2122,8 +2123,8 @@ async fn read_requires_dist(project_root: &Path) -> Result<pypi_types::RequiresD
}; };
// Parse the metadata. // Parse the metadata.
let requires_dist = let requires_dist = uv_pypi_types::RequiresDist::parse_pyproject_toml(&content)
pypi_types::RequiresDist::parse_pyproject_toml(&content).map_err(Error::PyprojectToml)?; .map_err(Error::PyprojectToml)?;
Ok(requires_dist) Ok(requires_dist)
} }

View file

@ -1,8 +1,8 @@
use distribution_types::Hashed;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::path::Path; use std::path::Path;
use uv_distribution_types::Hashed;
use pypi_types::HashDigest; use uv_pypi_types::HashDigest;
/// The [`Revision`] is a thin wrapper around a unique identifier for the source distribution. /// The [`Revision`] is a thin wrapper around a unique identifier for the source distribution.
/// ///

View file

@ -13,8 +13,8 @@ license = { workspace = true }
workspace = true workspace = true
[dependencies] [dependencies]
distribution-filename = { workspace = true } uv-distribution-filename = { workspace = true }
pypi-types = { workspace = true } uv-pypi-types = { workspace = true }
async-compression = { workspace = true, features = ["bzip2", "gzip", "zstd", "xz"] } async-compression = { workspace = true, features = ["bzip2", "gzip", "zstd", "xz"] }
async_zip = { workspace = true } async_zip = { workspace = true }

View file

@ -4,7 +4,7 @@ use std::task::{Context, Poll};
use sha2::Digest; use sha2::Digest;
use tokio::io::{AsyncReadExt, ReadBuf}; use tokio::io::{AsyncReadExt, ReadBuf};
use pypi_types::{HashAlgorithm, HashDigest}; use uv_pypi_types::{HashAlgorithm, HashDigest};
pub struct Sha256Reader<'a, R> { pub struct Sha256Reader<'a, R> {
reader: R, reader: R,

View file

@ -2,11 +2,11 @@ use std::path::Path;
use std::pin::Pin; use std::pin::Pin;
use crate::Error; use crate::Error;
use distribution_filename::SourceDistExtension;
use futures::StreamExt; use futures::StreamExt;
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;
use tokio_util::compat::{FuturesAsyncReadCompatExt, TokioAsyncReadCompatExt}; use tokio_util::compat::{FuturesAsyncReadCompatExt, TokioAsyncReadCompatExt};
use tracing::warn; use tracing::warn;
use uv_distribution_filename::SourceDistExtension;
const DEFAULT_BUF_SIZE: usize = 128 * 1024; const DEFAULT_BUF_SIZE: usize = 128 * 1024;

View file

@ -13,7 +13,7 @@ license = { workspace = true }
workspace = true workspace = true
[dependencies] [dependencies]
cache-key = { workspace = true } uv-cache-key = { workspace = true }
uv-fs = { workspace = true, features = ["tokio"] } uv-fs = { workspace = true, features = ["tokio"] }
uv-auth = { workspace = true } uv-auth = { workspace = true }

View file

@ -1,9 +1,9 @@
use cache_key::RepositoryUrl;
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::{Arc, LazyLock, RwLock}; use std::sync::{Arc, LazyLock, RwLock};
use tracing::trace; use tracing::trace;
use url::Url; use url::Url;
use uv_auth::Credentials; use uv_auth::Credentials;
use uv_cache_key::RepositoryUrl;
/// Global authentication cache for a uv invocation. /// Global authentication cache for a uv invocation.
/// ///

View file

@ -4,11 +4,11 @@ use std::sync::Arc;
use tracing::debug; use tracing::debug;
use cache_key::RepositoryUrl;
use dashmap::mapref::one::Ref; use dashmap::mapref::one::Ref;
use dashmap::DashMap; use dashmap::DashMap;
use fs_err::tokio as fs; use fs_err::tokio as fs;
use reqwest_middleware::ClientWithMiddleware; use reqwest_middleware::ClientWithMiddleware;
use uv_cache_key::{cache_digest, RepositoryUrl};
use uv_fs::LockedFile; use uv_fs::LockedFile;
use crate::{Fetch, GitReference, GitSha, GitSource, GitUrl, Reporter}; use crate::{Fetch, GitReference, GitSha, GitSource, GitUrl, Reporter};
@ -65,7 +65,7 @@ impl GitResolver {
fs::create_dir_all(&lock_dir).await?; fs::create_dir_all(&lock_dir).await?;
let repository_url = RepositoryUrl::new(url.repository()); let repository_url = RepositoryUrl::new(url.repository());
let _lock = LockedFile::acquire( let _lock = LockedFile::acquire(
lock_dir.join(cache_key::cache_digest(&repository_url)), lock_dir.join(cache_digest(&repository_url)),
&repository_url, &repository_url,
) )
.await?; .await?;

View file

@ -10,7 +10,7 @@ use reqwest_middleware::ClientWithMiddleware;
use tracing::{debug, instrument}; use tracing::{debug, instrument};
use url::Url; use url::Url;
use cache_key::{cache_digest, RepositoryUrl}; use uv_cache_key::{cache_digest, RepositoryUrl};
use crate::git::GitRemote; use crate::git::GitRemote;
use crate::{GitOid, GitSha, GitUrl, GIT_STORE}; use crate::{GitOid, GitSha, GitUrl, GIT_STORE};

View file

@ -1,5 +1,5 @@
[package] [package]
name = "install-wheel-rs" name = "uv-install-wheel"
version = "0.0.1" version = "0.0.1"
publish = false publish = false
description = "Takes a wheel and installs it." description = "Takes a wheel and installs it."
@ -20,13 +20,13 @@ workspace = true
name = "install_wheel_rs" name = "install_wheel_rs"
[dependencies] [dependencies]
distribution-filename = { workspace = true }
pep440_rs = { workspace = true }
platform-tags = { workspace = true }
pypi-types = { workspace = true }
uv-cache-info = { workspace = true } uv-cache-info = { workspace = true }
uv-distribution-filename = { workspace = true }
uv-fs = { workspace = true } uv-fs = { workspace = true }
uv-normalize = { workspace = true } uv-normalize = { workspace = true }
uv-pep440 = { workspace = true }
uv-platform-tags = { workspace = true }
uv-pypi-types = { workspace = true }
uv-warnings = { workspace = true } uv-warnings = { workspace = true }
clap = { workspace = true, optional = true, features = ["derive"] } clap = { workspace = true, optional = true, features = ["derive"] }

View file

@ -7,12 +7,12 @@ use platform_info::PlatformInfoError;
use thiserror::Error; use thiserror::Error;
use zip::result::ZipError; use zip::result::ZipError;
use pep440_rs::Version;
use platform_tags::{Arch, Os};
use pypi_types::Scheme;
pub use uninstall::{uninstall_egg, uninstall_legacy_editable, uninstall_wheel, Uninstall}; pub use uninstall::{uninstall_egg, uninstall_legacy_editable, uninstall_wheel, Uninstall};
use uv_fs::Simplified; use uv_fs::Simplified;
use uv_normalize::PackageName; use uv_normalize::PackageName;
use uv_pep440::Version;
use uv_platform_tags::{Arch, Os};
use uv_pypi_types::Scheme;
pub use wheel::{parse_wheel_file, read_record_file, LibKind}; pub use wheel::{parse_wheel_file, read_record_file, LibKind};
pub mod linker; pub mod linker;
@ -55,7 +55,7 @@ pub enum Error {
InvalidWheel(String), InvalidWheel(String),
/// Doesn't follow file name schema /// Doesn't follow file name schema
#[error(transparent)] #[error(transparent)]
InvalidWheelFileName(#[from] distribution_filename::WheelFilenameError), InvalidWheelFileName(#[from] uv_distribution_filename::WheelFilenameError),
/// The caller must add the name of the zip file (See note on type). /// The caller must add the name of the zip file (See note on type).
#[error("Failed to read {0} from zip file")] #[error("Failed to read {0} from zip file")]
Zip(String, #[source] ZipError), Zip(String, #[source] ZipError),
@ -90,7 +90,7 @@ pub enum Error {
#[error("Invalid package name")] #[error("Invalid package name")]
InvalidName(#[from] uv_normalize::InvalidNameError), InvalidName(#[from] uv_normalize::InvalidNameError),
#[error("Invalid package version")] #[error("Invalid package version")]
InvalidVersion(#[from] pep440_rs::VersionParseError), InvalidVersion(#[from] uv_pep440::VersionParseError),
#[error("Wheel package name does not match filename: {0} != {1}")] #[error("Wheel package name does not match filename: {0} != {1}")]
MismatchedName(PackageName, PackageName), MismatchedName(PackageName, PackageName),
#[error("Wheel version does not match filename: {0} != {1}")] #[error("Wheel version does not match filename: {0} != {1}")]

Some files were not shown because too many files have changed in this diff Show more