mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-26 12:09:12 +00:00
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:
parent
7b55e97909
commit
14507a1793
319 changed files with 1327 additions and 1317 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -1692,7 +1692,7 @@ jobs:
|
|||
cargo run --bin uv -- pip compile scripts/requirements/airflow.in --universal --exclude-newer 2024-08-08 --cache-dir .cache
|
||||
|
||||
- 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"
|
||||
uses: CodSpeedHQ/action@v3
|
||||
|
|
666
Cargo.lock
generated
666
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
23
Cargo.toml
23
Cargo.toml
|
@ -21,38 +21,38 @@ authors = ["uv"]
|
|||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[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-build-frontend = { path = "crates/uv-build-frontend" }
|
||||
uv-cache = { path = "crates/uv-cache" }
|
||||
uv-cache-info = { path = "crates/uv-cache-info" }
|
||||
uv-cache-key = { path = "crates/uv-cache-key" }
|
||||
uv-cli = { path = "crates/uv-cli" }
|
||||
uv-client = { path = "crates/uv-client" }
|
||||
uv-configuration = { path = "crates/uv-configuration" }
|
||||
uv-console = { path = "crates/uv-console" }
|
||||
uv-dispatch = { path = "crates/uv-dispatch" }
|
||||
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-fs = { path = "crates/uv-fs" }
|
||||
uv-git = { path = "crates/uv-git" }
|
||||
uv-install-wheel = { path = "crates/uv-install-wheel", default-features = false }
|
||||
uv-installer = { path = "crates/uv-installer" }
|
||||
uv-macros = { path = "crates/uv-macros" }
|
||||
uv-metadata = { path = "crates/uv-metadata" }
|
||||
uv-normalize = { path = "crates/uv-normalize" }
|
||||
uv-once-map = { path = "crates/uv-once-map" }
|
||||
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-publish = { path = "crates/uv-publish" }
|
||||
uv-pypi-types = { path = "crates/uv-pypi-types" }
|
||||
uv-python = { path = "crates/uv-python" }
|
||||
uv-requirements = { path = "crates/uv-requirements" }
|
||||
uv-requirements-txt = { path = "crates/uv-requirements-txt" }
|
||||
uv-resolver = { path = "crates/uv-resolver" }
|
||||
uv-scripts = { path = "crates/uv-scripts" }
|
||||
uv-settings = { path = "crates/uv-settings" }
|
||||
|
@ -178,9 +178,6 @@ zip = { version = "0.6.6", default-features = false, features = ["deflate"] }
|
|||
ignored = ["flate2", "xz2"]
|
||||
|
||||
[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" }
|
||||
|
||||
[workspace.lints.rust]
|
||||
|
|
|
@ -7,12 +7,13 @@ edition = "2021"
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
uv-once-map = { workspace = true }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
base64 = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
http = { workspace = true }
|
||||
once-map = { workspace = true }
|
||||
reqwest = { workspace = true }
|
||||
reqwest-middleware = { workspace = true }
|
||||
rust-netrc = { workspace = true }
|
||||
|
|
|
@ -6,7 +6,7 @@ use rustc_hash::{FxHashMap, FxHasher};
|
|||
use tracing::trace;
|
||||
use url::Url;
|
||||
|
||||
use once_map::OnceMap;
|
||||
use uv_once_map::OnceMap;
|
||||
|
||||
use crate::credentials::{Credentials, Username};
|
||||
use crate::Realm;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "bench"
|
||||
name = "uv-bench"
|
||||
version = "0.0.0"
|
||||
description = "uv Micro-benchmarks"
|
||||
publish = false
|
||||
|
@ -28,19 +28,19 @@ path = "benches/uv.rs"
|
|||
harness = false
|
||||
|
||||
[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-client = { workspace = true }
|
||||
uv-configuration = { workspace = true }
|
||||
uv-dispatch = { workspace = true }
|
||||
uv-distribution = { workspace = true }
|
||||
uv-distribution-filename = { workspace = true }
|
||||
uv-distribution-types = { 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-resolver = { workspace = true }
|
||||
uv-types = { workspace = true }
|
|
@ -1,8 +1,8 @@
|
|||
use {distribution_filename::WheelFilename, platform_tags::Tags};
|
||||
|
||||
use bench::criterion::{
|
||||
use uv_bench::criterion::{
|
||||
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.
|
||||
/// 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!(
|
||||
distribution_filename,
|
||||
uv_distribution_filename,
|
||||
benchmark_build_platform_tags,
|
||||
benchmark_wheelname_parsing,
|
||||
benchmark_wheelname_parsing_failure,
|
||||
benchmark_wheelname_tag_compatibility,
|
||||
);
|
||||
criterion_main!(distribution_filename);
|
||||
criterion_main!(uv_distribution_filename);
|
|
@ -1,32 +1,32 @@
|
|||
use std::str::FromStr;
|
||||
|
||||
use bench::criterion::black_box;
|
||||
use bench::criterion::{criterion_group, criterion_main, measurement::WallTime, Criterion};
|
||||
use pypi_types::Requirement;
|
||||
use uv_bench::criterion::black_box;
|
||||
use uv_bench::criterion::{criterion_group, criterion_main, measurement::WallTime, Criterion};
|
||||
use uv_cache::Cache;
|
||||
use uv_client::RegistryClientBuilder;
|
||||
use uv_pypi_types::Requirement;
|
||||
use uv_python::PythonEnvironment;
|
||||
use uv_resolver::Manifest;
|
||||
|
||||
fn resolve_warm_jupyter(c: &mut Criterion<WallTime>) {
|
||||
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)));
|
||||
}
|
||||
|
||||
fn resolve_warm_jupyter_universal(c: &mut Criterion<WallTime>) {
|
||||
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)));
|
||||
}
|
||||
|
||||
fn resolve_warm_airflow(c: &mut Criterion<WallTime>) {
|
||||
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(
|
||||
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)));
|
||||
|
@ -35,9 +35,9 @@ fn resolve_warm_airflow(c: &mut Criterion<WallTime>) {
|
|||
// This takes >5m to run in CodSpeed.
|
||||
// fn resolve_warm_airflow_universal(c: &mut Criterion<WallTime>) {
|
||||
// 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(
|
||||
// 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)));
|
||||
|
@ -83,12 +83,7 @@ mod resolver {
|
|||
|
||||
use anyhow::Result;
|
||||
|
||||
use distribution_types::{DependencyMetadata, IndexCapabilities, IndexLocations};
|
||||
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_client::RegistryClient;
|
||||
use uv_configuration::{
|
||||
|
@ -96,7 +91,12 @@ mod resolver {
|
|||
};
|
||||
use uv_dispatch::BuildDispatch;
|
||||
use uv_distribution::DistributionDatabase;
|
||||
use uv_distribution_types::{DependencyMetadata, IndexCapabilities, IndexLocations};
|
||||
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_resolver::{
|
||||
FlatIndex, InMemoryIndex, Manifest, OptionsBuilder, PythonRequirement, RequiresPython,
|
|
@ -14,12 +14,12 @@ license = { workspace = true }
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
distribution-types = { workspace = true }
|
||||
pep440_rs = { workspace = true }
|
||||
pep508_rs = { workspace = true }
|
||||
pypi-types = { workspace = true }
|
||||
uv-configuration = { workspace = true }
|
||||
uv-distribution-types = { workspace = true }
|
||||
uv-fs = { workspace = true }
|
||||
uv-pep440 = { workspace = true }
|
||||
uv-pep508 = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
uv-python = { workspace = true }
|
||||
uv-types = { workspace = true }
|
||||
uv-virtualenv = { workspace = true }
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
use crate::PythonRunnerOutput;
|
||||
use itertools::Itertools;
|
||||
use pep440_rs::Version;
|
||||
use pep508_rs::PackageName;
|
||||
use regex::Regex;
|
||||
use std::env;
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
@ -13,6 +11,8 @@ use thiserror::Error;
|
|||
use tracing::error;
|
||||
use uv_configuration::BuildOutput;
|
||||
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`
|
||||
static MISSING_HEADER_RE_GCC: LazyLock<Regex> = LazyLock::new(|| {
|
||||
|
@ -285,11 +285,11 @@ impl Error {
|
|||
mod test {
|
||||
use crate::{Error, PythonRunnerOutput};
|
||||
use indoc::indoc;
|
||||
use pep440_rs::Version;
|
||||
use pep508_rs::PackageName;
|
||||
use std::process::ExitStatus;
|
||||
use std::str::FromStr;
|
||||
use uv_configuration::BuildOutput;
|
||||
use uv_pep440::Version;
|
||||
use uv_pep508::PackageName;
|
||||
|
||||
#[test]
|
||||
fn missing_header() {
|
||||
|
|
|
@ -27,12 +27,12 @@ use tokio::sync::{Mutex, Semaphore};
|
|||
use tracing::{debug, info_span, instrument, Instrument};
|
||||
|
||||
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_distribution_types::Resolution;
|
||||
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_types::{BuildContext, BuildIsolation, SourceBuildTrait};
|
||||
|
||||
|
@ -41,7 +41,7 @@ static DEFAULT_BACKEND: LazyLock<Pep517Backend> = LazyLock::new(|| Pep517Backend
|
|||
backend: "setuptools.build_meta:__legacy__".to_string(),
|
||||
backend_path: None,
|
||||
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")]
|
||||
struct BuildSystem {
|
||||
/// 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.
|
||||
build_backend: Option<String>,
|
||||
/// 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.
|
||||
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(
|
||||
format!(
|
||||
"Build backend failed to return requirements from `get_requires_for_build_{build_kind}`: {err}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "cache-key"
|
||||
name = "uv-cache-key"
|
||||
version = "0.0.1"
|
||||
description = "Generic functionality for caching paths, URLs, and other resources across platforms."
|
||||
edition = { workspace = true }
|
|
@ -14,12 +14,12 @@ license = { workspace = true }
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
cache-key = { workspace = true }
|
||||
distribution-types = { workspace = true }
|
||||
pypi-types = { workspace = true }
|
||||
uv-cache-info = { workspace = true }
|
||||
uv-cache-key = { workspace = true }
|
||||
uv-distribution-types = { workspace = true }
|
||||
uv-fs = { workspace = true, features = ["tokio"] }
|
||||
uv-normalize = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
|
||||
clap = { workspace = true, features = ["derive", "env"], optional = true }
|
||||
directories = { workspace = true }
|
||||
|
|
|
@ -10,11 +10,11 @@ use rustc_hash::FxHashSet;
|
|||
use tracing::debug;
|
||||
|
||||
pub use archive::ArchiveId;
|
||||
use distribution_types::InstalledDist;
|
||||
use pypi_types::ResolutionMetadata;
|
||||
use uv_cache_info::Timestamp;
|
||||
use uv_distribution_types::InstalledDist;
|
||||
use uv_fs::{cachedir, directories};
|
||||
use uv_normalize::PackageName;
|
||||
use uv_pypi_types::ResolutionMetadata;
|
||||
|
||||
pub use crate::by_timestamp::CachedByTimestamp;
|
||||
#[cfg(feature = "clap")]
|
||||
|
|
|
@ -2,8 +2,8 @@ use std::path::{Path, PathBuf};
|
|||
|
||||
use url::Url;
|
||||
|
||||
use cache_key::{cache_digest, CanonicalUrl};
|
||||
use distribution_types::IndexUrl;
|
||||
use uv_cache_key::{cache_digest, CanonicalUrl};
|
||||
use uv_distribution_types::IndexUrl;
|
||||
|
||||
/// Cache wheels and their metadata, both from remote wheels and built from source distributions.
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
@ -14,13 +14,13 @@ license = { workspace = true }
|
|||
workspace = true
|
||||
|
||||
[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-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-pep508 = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
uv-python = { workspace = true, features = ["clap", "schemars"]}
|
||||
uv-resolver = { workspace = true, features = ["clap"] }
|
||||
uv-settings = { workspace = true, features = ["schemars"] }
|
||||
|
|
|
@ -7,16 +7,16 @@ use anyhow::{anyhow, Result};
|
|||
use clap::builder::styling::{AnsiColor, Effects, Style};
|
||||
use clap::builder::Styles;
|
||||
use clap::{Args, Parser, Subcommand};
|
||||
use distribution_types::{FlatIndexLocation, IndexUrl};
|
||||
use pep508_rs::Requirement;
|
||||
use pypi_types::VerbatimParsedUrl;
|
||||
use url::Url;
|
||||
use uv_cache::CacheArgs;
|
||||
use uv_configuration::{
|
||||
ConfigSettingEntry, ExportFormat, IndexStrategy, KeyringProviderType, PackageNameSpecifier,
|
||||
TargetTriple, TrustedHost, TrustedPublishing, VersionControlSystem,
|
||||
};
|
||||
use uv_distribution_types::{FlatIndexLocation, IndexUrl};
|
||||
use uv_normalize::{ExtraName, PackageName};
|
||||
use uv_pep508::Requirement;
|
||||
use uv_pypi_types::VerbatimParsedUrl;
|
||||
use uv_python::{PythonDownloads, PythonPreference, PythonVersion};
|
||||
use uv_resolver::{AnnotationStyle, ExcludeNewer, PrereleaseMode, ResolutionMode};
|
||||
|
||||
|
|
|
@ -7,19 +7,19 @@ edition = "2021"
|
|||
workspace = true
|
||||
|
||||
[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-cache = { workspace = true }
|
||||
uv-cache-key = { workspace = true }
|
||||
uv-configuration = { workspace = true }
|
||||
uv-distribution-filename = { workspace = true }
|
||||
uv-distribution-types = { workspace = true }
|
||||
uv-fs = { workspace = true, features = ["tokio"] }
|
||||
uv-metadata = { 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-warnings = { workspace = true }
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@ use std::path::Path;
|
|||
use std::{env, iter};
|
||||
|
||||
use itertools::Itertools;
|
||||
use pep508_rs::MarkerEnvironment;
|
||||
use platform_tags::Platform;
|
||||
use reqwest::{Client, ClientBuilder, Response};
|
||||
use reqwest_middleware::ClientWithMiddleware;
|
||||
use reqwest_retry::policies::ExponentialBackoff;
|
||||
|
@ -17,6 +15,8 @@ use url::Url;
|
|||
use uv_auth::AuthMiddleware;
|
||||
use uv_configuration::{KeyringProviderType, TrustedHost};
|
||||
use uv_fs::Simplified;
|
||||
use uv_pep508::MarkerEnvironment;
|
||||
use uv_platform_tags::Platform;
|
||||
use uv_version::version;
|
||||
use uv_warnings::warn_user_once;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use async_http_range_reader::AsyncHttpRangeReaderError;
|
|||
use async_zip::error::ZipError;
|
||||
use url::Url;
|
||||
|
||||
use distribution_filename::{WheelFilename, WheelFilenameError};
|
||||
use uv_distribution_filename::{WheelFilename, WheelFilenameError};
|
||||
use uv_normalize::PackageName;
|
||||
|
||||
use crate::html;
|
||||
|
@ -140,7 +140,7 @@ pub enum ErrorKind {
|
|||
UrlParse(#[from] url::ParseError),
|
||||
|
||||
#[error(transparent)]
|
||||
JoinRelativeUrl(#[from] pypi_types::JoinRelativeError),
|
||||
JoinRelativeUrl(#[from] uv_pypi_types::JoinRelativeError),
|
||||
|
||||
#[error("Expected a file URL, but received: {0}")]
|
||||
NonFileUrl(Url),
|
||||
|
@ -170,7 +170,7 @@ pub enum ErrorKind {
|
|||
MetadataParseError(
|
||||
WheelFilename,
|
||||
String,
|
||||
#[source] Box<pypi_types::MetadataError>,
|
||||
#[source] Box<uv_pypi_types::MetadataError>,
|
||||
),
|
||||
|
||||
/// The metadata file was not found in the wheel.
|
||||
|
|
|
@ -5,13 +5,13 @@ use reqwest::Response;
|
|||
use tracing::{debug, info_span, warn, Instrument};
|
||||
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::html::SimpleHtml;
|
||||
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)]
|
||||
pub enum FlatIndexError {
|
||||
|
@ -30,7 +30,7 @@ pub enum FindLinksDirectoryError {
|
|||
#[error(transparent)]
|
||||
Io(#[from] std::io::Error),
|
||||
#[error(transparent)]
|
||||
VerbatimUrl(#[from] pep508_rs::VerbatimUrlError),
|
||||
VerbatimUrl(#[from] uv_pep508::VerbatimUrlError),
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
|
@ -141,7 +141,7 @@ impl<'a> FlatIndexClient<'a> {
|
|||
let cache_entry = self.cache.entry(
|
||||
CacheBucket::FlatIndex,
|
||||
"html",
|
||||
format!("{}.msgpack", cache_key::cache_digest(&url.to_string())),
|
||||
format!("{}.msgpack", cache_digest(&url.to_string())),
|
||||
);
|
||||
let cache_control = match self.client.connectivity() {
|
||||
Connectivity::Online => CacheControl::from(
|
||||
|
|
|
@ -4,9 +4,9 @@ use tl::HTMLTag;
|
|||
use tracing::{instrument, warn};
|
||||
use url::Url;
|
||||
|
||||
use pep440_rs::VersionSpecifiers;
|
||||
use pypi_types::LenientVersionSpecifiers;
|
||||
use pypi_types::{BaseUrl, CoreMetadata, File, Hashes, Yanked};
|
||||
use uv_pep440::VersionSpecifiers;
|
||||
use uv_pypi_types::LenientVersionSpecifiers;
|
||||
use uv_pypi_types::{BaseUrl, CoreMetadata, File, Hashes, Yanked};
|
||||
|
||||
/// A parsed structure from PyPI "HTML" index format for a single package.
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -200,10 +200,10 @@ pub enum Error {
|
|||
MissingHash(String),
|
||||
|
||||
#[error(transparent)]
|
||||
FragmentParse(#[from] pypi_types::HashError),
|
||||
FragmentParse(#[from] uv_pypi_types::HashError),
|
||||
|
||||
#[error("Invalid `requires-python` specifier: {0}")]
|
||||
Pep440(#[source] pep440_rs::VersionSpecifiersParseError),
|
||||
Pep440(#[source] uv_pep440::VersionSpecifiersParseError),
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -3,8 +3,8 @@ use std::env;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use tracing::instrument;
|
||||
|
||||
use pep508_rs::MarkerEnvironment;
|
||||
use platform_tags::{Os, Platform};
|
||||
use uv_pep508::MarkerEnvironment;
|
||||
use uv_platform_tags::{Os, Platform};
|
||||
use uv_version::version;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
||||
|
@ -68,7 +68,7 @@ impl LineHaul {
|
|||
.iter()
|
||||
.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 {
|
||||
lib: Some("glibc".to_string()),
|
||||
version: Some(format!("{major}.{minor}")),
|
||||
|
@ -94,7 +94,7 @@ impl LineHaul {
|
|||
libc,
|
||||
})
|
||||
} 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}")),
|
||||
_ => None,
|
||||
};
|
||||
|
|
|
@ -11,19 +11,19 @@ use reqwest_middleware::ClientWithMiddleware;
|
|||
use tracing::{info_span, instrument, trace, warn, Instrument};
|
||||
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_configuration::KeyringProviderType;
|
||||
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_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::cached_client::CacheControl;
|
||||
|
@ -419,7 +419,7 @@ impl RegistryClient {
|
|||
|
||||
let location = match &wheel.file.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)?;
|
||||
if url.scheme() == "file" {
|
||||
let path = url
|
||||
|
@ -783,7 +783,7 @@ impl SimpleMetadata {
|
|||
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();
|
||||
|
||||
// Group the distributions by version and kind
|
||||
|
@ -906,8 +906,8 @@ mod tests {
|
|||
|
||||
use url::Url;
|
||||
|
||||
use pypi_types::{JoinRelativeError, SimpleJson};
|
||||
use uv_normalize::PackageName;
|
||||
use uv_pypi_types::{JoinRelativeError, SimpleJson};
|
||||
|
||||
use crate::{html::SimpleHtml, SimpleMetadata, SimpleMetadatum};
|
||||
|
||||
|
@ -991,7 +991,7 @@ mod tests {
|
|||
// Test parsing of the file urls
|
||||
let urls = files
|
||||
.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>>()?;
|
||||
let urls = urls.iter().map(reqwest::Url::as_str).collect::<Vec<_>>();
|
||||
insta::assert_debug_snapshot!(urls, @r###"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use crate::{Error, ErrorKind};
|
||||
use async_http_range_reader::AsyncHttpRangeReader;
|
||||
use distribution_filename::WheelFilename;
|
||||
use futures::io::BufReader;
|
||||
use tokio_util::compat::TokioAsyncReadCompatExt;
|
||||
use url::Url;
|
||||
use uv_distribution_filename::WheelFilename;
|
||||
use uv_metadata::find_archive_dist_info;
|
||||
|
||||
/// Read the `.dist-info/METADATA` file from a async remote zip reader, so we avoid downloading the
|
||||
|
|
|
@ -3,11 +3,11 @@ use std::str::FromStr;
|
|||
use anyhow::Result;
|
||||
use url::Url;
|
||||
|
||||
use distribution_filename::WheelFilename;
|
||||
use distribution_types::{BuiltDist, DirectUrlBuiltDist, IndexCapabilities};
|
||||
use pep508_rs::VerbatimUrl;
|
||||
use uv_cache::Cache;
|
||||
use uv_client::RegistryClientBuilder;
|
||||
use uv_distribution_filename::WheelFilename;
|
||||
use uv_distribution_types::{BuiltDist, DirectUrlBuiltDist, IndexCapabilities};
|
||||
use uv_pep508::VerbatimUrl;
|
||||
|
||||
#[tokio::test]
|
||||
async fn remote_metadata_with_and_without_cache() -> Result<()> {
|
||||
|
|
|
@ -10,11 +10,11 @@ use hyper_util::rt::TokioIo;
|
|||
use insta::{assert_json_snapshot, assert_snapshot, with_settings};
|
||||
use tokio::net::TcpListener;
|
||||
|
||||
use pep508_rs::{MarkerEnvironment, MarkerEnvironmentBuilder};
|
||||
use platform_tags::{Arch, Os, Platform};
|
||||
use uv_cache::Cache;
|
||||
use uv_client::LineHaul;
|
||||
use uv_client::RegistryClientBuilder;
|
||||
use uv_pep508::{MarkerEnvironment, MarkerEnvironmentBuilder};
|
||||
use uv_platform_tags::{Arch, Os, Platform};
|
||||
use uv_version::version;
|
||||
|
||||
#[tokio::test]
|
||||
|
|
|
@ -13,14 +13,14 @@ license = { workspace = true }
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
cache-key = { workspace = true }
|
||||
pep508_rs = { workspace = true, features = ["schemars"] }
|
||||
platform-tags = { workspace = true }
|
||||
pypi-types = { workspace = true }
|
||||
uv-auth = { workspace = true }
|
||||
uv-cache = { workspace = true }
|
||||
uv-cache-info = { workspace = true }
|
||||
uv-cache-key = { 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 }
|
||||
either = { workspace = true }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::fmt::{Display, Formatter};
|
||||
|
||||
use pep508_rs::PackageName;
|
||||
use uv_pep508::PackageName;
|
||||
|
||||
use crate::{PackageNameSpecifier, PackageNameSpecifiers};
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use cache_key::CacheKeyHasher;
|
||||
use std::{
|
||||
collections::{btree_map::Entry, BTreeMap},
|
||||
str::FromStr,
|
||||
};
|
||||
use uv_cache_key::CacheKeyHasher;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
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) {
|
||||
for (key, value) in &self.0 {
|
||||
key.cache_key(state);
|
||||
|
|
|
@ -3,9 +3,9 @@ use std::borrow::Cow;
|
|||
use either::Either;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use pep508_rs::MarkerTree;
|
||||
use pypi_types::{Requirement, RequirementSource};
|
||||
use uv_normalize::PackageName;
|
||||
use uv_pep508::MarkerTree;
|
||||
use uv_pypi_types::{Requirement, RequirementSource};
|
||||
|
||||
/// A set of constraints for a set of requirements.
|
||||
#[derive(Debug, Default, Clone)]
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::collections::BTreeSet;
|
|||
|
||||
use tracing::debug;
|
||||
|
||||
use pep508_rs::PackageName;
|
||||
use uv_pep508::PackageName;
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct InstallOptions {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::str::FromStr;
|
||||
|
||||
use pep508_rs::PackageName;
|
||||
use uv_pep508::PackageName;
|
||||
|
||||
/// A specifier used for (e.g.) pip's `--no-binary` flag.
|
||||
///
|
||||
|
|
|
@ -3,9 +3,9 @@ use std::borrow::Cow;
|
|||
use either::Either;
|
||||
use rustc_hash::{FxBuildHasher, FxHashMap};
|
||||
|
||||
use pep508_rs::MarkerTree;
|
||||
use pypi_types::Requirement;
|
||||
use uv_normalize::PackageName;
|
||||
use uv_pep508::MarkerTree;
|
||||
use uv_pypi_types::Requirement;
|
||||
|
||||
/// A set of overrides for a set of requirements.
|
||||
#[derive(Debug, Default, Clone)]
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use either::Either;
|
||||
use pep508_rs::PackageName;
|
||||
use uv_pep508::PackageName;
|
||||
|
||||
use pypi_types::Requirement;
|
||||
use rustc_hash::FxHashMap;
|
||||
use uv_cache::Refresh;
|
||||
use uv_cache_info::Timestamp;
|
||||
use uv_pypi_types::Requirement;
|
||||
|
||||
/// Whether to reinstall packages.
|
||||
#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use tracing::debug;
|
||||
|
||||
use pep508_rs::MarkerEnvironment;
|
||||
use platform_tags::{Arch, Os, Platform};
|
||||
use uv_pep508::MarkerEnvironment;
|
||||
use uv_platform_tags::{Arch, Os, Platform};
|
||||
|
||||
/// The supported target triples. Each triple consists of an architecture, vendor, and operating
|
||||
/// system.
|
||||
|
|
|
@ -16,16 +16,16 @@ license = { workspace = true }
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
distribution-filename = { workspace = true }
|
||||
distribution-types = { workspace = true }
|
||||
pep508_rs = { workspace = true }
|
||||
pypi-types = { workspace = true }
|
||||
uv-cache = { workspace = true, features = ["clap"] }
|
||||
uv-cli = { workspace = true }
|
||||
uv-client = { workspace = true }
|
||||
uv-distribution-filename = { workspace = true }
|
||||
uv-distribution-types = { workspace = true }
|
||||
uv-installer = { workspace = true }
|
||||
uv-macros = { workspace = true }
|
||||
uv-options-metadata = { workspace = true }
|
||||
uv-pep508 = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
uv-python = { workspace = true }
|
||||
uv-settings = { workspace = true, features = ["schemars"] }
|
||||
uv-workspace = { workspace = true, features = ["schemars"] }
|
||||
|
|
|
@ -4,12 +4,12 @@ use anstream::println;
|
|||
use anyhow::{bail, Result};
|
||||
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_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)]
|
||||
pub(crate) struct WheelMetadataArgs {
|
||||
|
|
|
@ -14,16 +14,16 @@ license = { workspace = true }
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
distribution-types = { workspace = true }
|
||||
install-wheel-rs = { workspace = true }
|
||||
pypi-types = { workspace = true }
|
||||
uv-build-frontend = { workspace = true }
|
||||
uv-cache = { workspace = true }
|
||||
uv-client = { workspace = true }
|
||||
uv-configuration = { workspace = true }
|
||||
uv-distribution = { workspace = true }
|
||||
uv-distribution-types = { workspace = true }
|
||||
uv-git = { workspace = true }
|
||||
uv-install-wheel = { workspace = true }
|
||||
uv-installer = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
uv-python = { workspace = true }
|
||||
uv-resolver = { workspace = true }
|
||||
uv-types = { workspace = true }
|
||||
|
|
|
@ -11,11 +11,6 @@ use itertools::Itertools;
|
|||
use rustc_hash::FxHashMap;
|
||||
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_cache::Cache;
|
||||
use uv_client::RegistryClient;
|
||||
|
@ -24,8 +19,13 @@ use uv_configuration::{
|
|||
};
|
||||
use uv_configuration::{BuildOutput, Concurrency};
|
||||
use uv_distribution::DistributionDatabase;
|
||||
use uv_distribution_types::{
|
||||
CachedDist, DependencyMetadata, IndexCapabilities, IndexLocations, Name, Resolution,
|
||||
SourceDist, VersionOrUrlRef,
|
||||
};
|
||||
use uv_git::GitResolver;
|
||||
use uv_installer::{Installer, Plan, Planner, Preparer, SitePackages};
|
||||
use uv_pypi_types::Requirement;
|
||||
use uv_python::{Interpreter, PythonEnvironment};
|
||||
use uv_resolver::{
|
||||
ExcludeNewer, FlatIndex, InMemoryIndex, Manifest, OptionsBuilder, PythonRequirement, Resolver,
|
||||
|
@ -314,9 +314,9 @@ impl<'a> BuildContext for BuildDispatch<'a> {
|
|||
build_kind: BuildKind,
|
||||
build_output: BuildOutput,
|
||||
) -> 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
|
||||
.map(distribution_types::DistributionMetadata::version_or_url)
|
||||
.map(uv_distribution_types::DistributionMetadata::version_or_url)
|
||||
.and_then(|version| match version {
|
||||
VersionOrUrlRef::Version(version) => Some(version),
|
||||
VersionOrUrlRef::Url(_) => None,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "distribution-filename"
|
||||
name = "uv-distribution-filename"
|
||||
version = "0.0.1"
|
||||
edition = { workspace = true }
|
||||
rust-version = { workspace = true }
|
||||
|
@ -13,9 +13,9 @@ license = { workspace = true }
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
pep440_rs = { workspace = true }
|
||||
platform-tags = { workspace = true }
|
||||
uv-normalize = { workspace = true }
|
||||
uv-pep440 = { workspace = true }
|
||||
uv-platform-tags = { workspace = true }
|
||||
|
||||
rkyv = { workspace = true }
|
||||
serde = { workspace = true }
|
|
@ -2,8 +2,8 @@ use std::str::FromStr;
|
|||
|
||||
use thiserror::Error;
|
||||
|
||||
use pep440_rs::{Version, VersionParseError};
|
||||
use uv_normalize::{InvalidNameError, PackageName};
|
||||
use uv_pep440::{Version, VersionParseError};
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum EggInfoFilenameError {
|
|
@ -1,7 +1,7 @@
|
|||
use pep440_rs::Version;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::str::FromStr;
|
||||
use uv_normalize::PackageName;
|
||||
use uv_pep440::Version;
|
||||
|
||||
pub use build_tag::{BuildTag, BuildTagError};
|
||||
pub use egg::{EggInfoFilename, EggInfoFilenameError};
|
|
@ -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\")"
|
||||
---
|
||||
Ok(
|
|
@ -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\")"
|
||||
---
|
||||
Ok(
|
|
@ -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\")"
|
||||
---
|
||||
Ok(
|
|
@ -2,10 +2,10 @@ use std::fmt::{Display, Formatter};
|
|||
use std::str::FromStr;
|
||||
|
||||
use crate::SourceDistExtension;
|
||||
use pep440_rs::{Version, VersionParseError};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
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
|
||||
/// need the latter.
|
|
@ -5,9 +5,9 @@ use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
|||
use thiserror::Error;
|
||||
use url::Url;
|
||||
|
||||
use pep440_rs::{Version, VersionParseError};
|
||||
use platform_tags::{TagCompatibility, Tags};
|
||||
use uv_normalize::{InvalidNameError, PackageName};
|
||||
use uv_pep440::{Version, VersionParseError};
|
||||
use uv_platform_tags::{TagCompatibility, Tags};
|
||||
|
||||
use crate::{BuildTag, BuildTagError};
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "distribution-types"
|
||||
name = "uv-distribution-types"
|
||||
version = "0.0.1"
|
||||
edition = { workspace = true }
|
||||
rust-version = { workspace = true }
|
||||
|
@ -13,16 +13,16 @@ license = { workspace = true }
|
|||
workspace = true
|
||||
|
||||
[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-key = { workspace = true }
|
||||
uv-distribution-filename = { workspace = true }
|
||||
uv-fs = { workspace = true }
|
||||
uv-git = { 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 }
|
||||
fs-err = { workspace = true }
|
|
@ -1,8 +1,8 @@
|
|||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
use pep508_rs::RequirementOrigin;
|
||||
use uv_fs::Simplified;
|
||||
use uv_normalize::PackageName;
|
||||
use uv_pep508::RequirementOrigin;
|
||||
|
||||
/// Source of a dependency, e.g., a `-r requirements.txt` file.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
|
@ -1,11 +1,11 @@
|
|||
use std::borrow::Cow;
|
||||
use std::path::Path;
|
||||
|
||||
use distribution_filename::SourceDistExtension;
|
||||
use pep440_rs::Version;
|
||||
use pep508_rs::VerbatimUrl;
|
||||
use url::Url;
|
||||
use uv_distribution_filename::SourceDistExtension;
|
||||
use uv_git::GitUrl;
|
||||
use uv_pep440::Version;
|
||||
use uv_pep508::VerbatimUrl;
|
||||
|
||||
use uv_normalize::PackageName;
|
||||
|
|
@ -2,11 +2,11 @@ use std::path::{Path, PathBuf};
|
|||
|
||||
use anyhow::{anyhow, Result};
|
||||
|
||||
use distribution_filename::WheelFilename;
|
||||
use pep508_rs::VerbatimUrl;
|
||||
use pypi_types::{HashDigest, ParsedDirectoryUrl};
|
||||
use uv_cache_info::CacheInfo;
|
||||
use uv_distribution_filename::WheelFilename;
|
||||
use uv_normalize::PackageName;
|
||||
use uv_pep508::VerbatimUrl;
|
||||
use uv_pypi_types::{HashDigest, ParsedDirectoryUrl};
|
||||
|
||||
use crate::{
|
||||
BuiltDist, Dist, DistributionMetadata, Hashed, InstalledMetadata, InstalledVersion, Name,
|
|
@ -1,9 +1,9 @@
|
|||
use pep440_rs::{Version, VersionSpecifiers};
|
||||
use pep508_rs::Requirement;
|
||||
use pypi_types::{ResolutionMetadata, VerbatimParsedUrl};
|
||||
use rustc_hash::FxHashMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
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`].
|
||||
#[derive(Debug, Clone, Default)]
|
|
@ -11,7 +11,7 @@ pub enum Error {
|
|||
Utf8(#[from] std::string::FromUtf8Error),
|
||||
|
||||
#[error(transparent)]
|
||||
WheelFilename(#[from] distribution_filename::WheelFilenameError),
|
||||
WheelFilename(#[from] uv_distribution_filename::WheelFilenameError),
|
||||
|
||||
#[error("Could not extract path segments from URL: {0}")]
|
||||
MissingPathSegments(String),
|
|
@ -7,11 +7,11 @@ use jiff::Timestamp;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use url::Url;
|
||||
|
||||
use pep440_rs::{VersionSpecifiers, VersionSpecifiersParseError};
|
||||
use pep508_rs::VerbatimUrl;
|
||||
use pypi_types::{CoreMetadata, HashDigest, Yanked};
|
||||
use uv_pep440::{VersionSpecifiers, VersionSpecifiersParseError};
|
||||
use uv_pep508::VerbatimUrl;
|
||||
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)]
|
||||
pub enum FileConversionError {
|
||||
#[error("Failed to parse `requires-python`: `{0}`")]
|
||||
|
@ -20,7 +20,7 @@ pub enum FileConversionError {
|
|||
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)]
|
||||
#[rkyv(derive(Debug))]
|
||||
pub struct File {
|
||||
|
@ -40,7 +40,7 @@ pub struct File {
|
|||
|
||||
impl File {
|
||||
/// `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 {
|
||||
dist_info_metadata: file
|
||||
.core_metadata
|
|
@ -1,4 +1,4 @@
|
|||
use pypi_types::{HashAlgorithm, HashDigest};
|
||||
use uv_pypi_types::{HashAlgorithm, HashDigest};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum HashPolicy<'a> {
|
|
@ -1,12 +1,12 @@
|
|||
use std::fmt::{Display, Formatter};
|
||||
use std::path::PathBuf;
|
||||
|
||||
use cache_key::{CanonicalUrl, RepositoryUrl};
|
||||
use url::Url;
|
||||
use uv_cache_key::{CanonicalUrl, RepositoryUrl};
|
||||
|
||||
use pep440_rs::Version;
|
||||
use pypi_types::HashDigest;
|
||||
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`)
|
||||
/// or a URL (e.g., `git+https://github.com/psf/black`).
|
|
@ -9,7 +9,7 @@ use std::sync::{Arc, LazyLock, RwLock};
|
|||
use thiserror::Error;
|
||||
use url::{ParseError, Url};
|
||||
|
||||
use pep508_rs::{VerbatimUrl, VerbatimUrlError};
|
||||
use uv_pep508::{VerbatimUrl, VerbatimUrlError};
|
||||
|
||||
use crate::Verbatim;
|
||||
|
|
@ -7,12 +7,12 @@ use fs_err as fs;
|
|||
use tracing::warn;
|
||||
use url::Url;
|
||||
|
||||
use distribution_filename::EggInfoFilename;
|
||||
use pep440_rs::Version;
|
||||
use pypi_types::DirectUrl;
|
||||
use uv_cache_info::CacheInfo;
|
||||
use uv_distribution_filename::EggInfoFilename;
|
||||
use uv_fs::Simplified;
|
||||
use uv_normalize::PackageName;
|
||||
use uv_pep440::Version;
|
||||
use uv_pypi_types::DirectUrl;
|
||||
|
||||
use crate::{DistributionMetadata, InstalledMetadata, InstalledVersion, Name, VersionOrUrlRef};
|
||||
|
||||
|
@ -285,13 +285,13 @@ impl InstalledDist {
|
|||
}
|
||||
|
||||
/// 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 {
|
||||
Self::Registry(_) | Self::Url(_) => {
|
||||
let path = self.path().join("METADATA");
|
||||
let contents = fs::read(&path)?;
|
||||
// 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!(
|
||||
"Failed to parse `METADATA` file at: {}",
|
||||
path.user_display()
|
||||
|
@ -306,7 +306,7 @@ impl InstalledDist {
|
|||
_ => unreachable!(),
|
||||
};
|
||||
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!(
|
||||
"Failed to parse `PKG-INFO` file at: {}",
|
||||
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) {
|
||||
Ok(content) => content,
|
||||
Err(err) => {
|
||||
|
@ -455,7 +455,7 @@ fn read_metadata(path: &Path) -> Option<pypi_types::Metadata10> {
|
|||
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,
|
||||
Err(err) => {
|
||||
warn!("Failed to parse metadata for {path:?}: {err}");
|
|
@ -39,13 +39,13 @@ use std::str::FromStr;
|
|||
|
||||
use url::Url;
|
||||
|
||||
use distribution_filename::{DistExtension, SourceDistExtension, WheelFilename};
|
||||
use pep440_rs::Version;
|
||||
use pep508_rs::{Pep508Url, VerbatimUrl};
|
||||
use pypi_types::{ParsedUrl, VerbatimParsedUrl};
|
||||
use uv_distribution_filename::{DistExtension, SourceDistExtension, WheelFilename};
|
||||
use uv_fs::normalize_absolute_path;
|
||||
use uv_git::GitUrl;
|
||||
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::any::*;
|
||||
|
@ -983,11 +983,11 @@ impl RemoteSource for Dist {
|
|||
|
||||
impl Identifier for Url {
|
||||
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 {
|
||||
ResourceId::Url(cache_key::RepositoryUrl::new(self))
|
||||
ResourceId::Url(uv_cache_key::RepositoryUrl::new(self))
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
use distribution_filename::BuildTag;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use uv_distribution_filename::BuildTag;
|
||||
|
||||
use pep440_rs::VersionSpecifiers;
|
||||
use platform_tags::{IncompatibleTag, TagPriority};
|
||||
use pypi_types::{HashDigest, Yanked};
|
||||
use uv_pep440::VersionSpecifiers;
|
||||
use uv_platform_tags::{IncompatibleTag, TagPriority};
|
||||
use uv_pypi_types::{HashDigest, Yanked};
|
||||
|
||||
use crate::{
|
||||
InstalledDist, RegistryBuiltDist, RegistryBuiltWheel, RegistrySourceDist, ResolvedDistRef,
|
|
@ -1,8 +1,8 @@
|
|||
use distribution_filename::DistExtension;
|
||||
use pep508_rs::MarkerTree;
|
||||
use pypi_types::{HashDigest, Requirement, RequirementSource};
|
||||
use std::collections::BTreeMap;
|
||||
use uv_distribution_filename::DistExtension;
|
||||
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};
|
||||
|
||||
|
@ -185,8 +185,8 @@ impl From<&ResolvedDist> for Requirement {
|
|||
let source = match resolved_dist {
|
||||
ResolvedDist::Installable(dist) => match dist {
|
||||
Dist::Built(BuiltDist::Registry(wheels)) => RequirementSource::Registry {
|
||||
specifier: pep440_rs::VersionSpecifiers::from(
|
||||
pep440_rs::VersionSpecifier::equals_version(
|
||||
specifier: uv_pep440::VersionSpecifiers::from(
|
||||
uv_pep440::VersionSpecifier::equals_version(
|
||||
wheels.best_wheel().filename.version.clone(),
|
||||
),
|
||||
),
|
||||
|
@ -208,8 +208,8 @@ impl From<&ResolvedDist> for Requirement {
|
|||
ext: DistExtension::Wheel,
|
||||
},
|
||||
Dist::Source(SourceDist::Registry(sdist)) => RequirementSource::Registry {
|
||||
specifier: pep440_rs::VersionSpecifiers::from(
|
||||
pep440_rs::VersionSpecifier::equals_version(sdist.version.clone()),
|
||||
specifier: uv_pep440::VersionSpecifiers::from(
|
||||
uv_pep440::VersionSpecifier::equals_version(sdist.version.clone()),
|
||||
),
|
||||
index: None,
|
||||
},
|
||||
|
@ -243,8 +243,8 @@ impl From<&ResolvedDist> for Requirement {
|
|||
},
|
||||
},
|
||||
ResolvedDist::Installed(dist) => RequirementSource::Registry {
|
||||
specifier: pep440_rs::VersionSpecifiers::from(
|
||||
pep440_rs::VersionSpecifier::equals_version(dist.version().clone()),
|
||||
specifier: uv_pep440::VersionSpecifiers::from(
|
||||
uv_pep440::VersionSpecifier::equals_version(dist.version().clone()),
|
||||
),
|
||||
index: None,
|
||||
},
|
|
@ -1,7 +1,7 @@
|
|||
use std::fmt::{Display, Formatter};
|
||||
|
||||
use pep508_rs::PackageName;
|
||||
use pypi_types::Yanked;
|
||||
use uv_pep508::PackageName;
|
||||
use uv_pypi_types::Yanked;
|
||||
|
||||
use crate::{
|
||||
BuiltDist, Dist, DistributionId, DistributionMetadata, Identifier, IndexUrl, InstalledDist,
|
|
@ -1,9 +1,9 @@
|
|||
use std::borrow::Cow;
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
||||
use pep508_rs::{MarkerEnvironment, UnnamedRequirement};
|
||||
use pypi_types::{Hashes, ParsedUrl, Requirement, RequirementSource};
|
||||
use uv_normalize::ExtraName;
|
||||
use uv_pep508::{MarkerEnvironment, UnnamedRequirement};
|
||||
use uv_pypi_types::{Hashes, ParsedUrl, Requirement, RequirementSource};
|
||||
|
||||
use crate::VerbatimParsedUrl;
|
||||
|
||||
|
@ -33,7 +33,7 @@ pub struct UnresolvedRequirementSpecification {
|
|||
/// resolve the requirement name.
|
||||
///
|
||||
/// Analog to `RequirementsTxtRequirement` but with `distribution_types::Requirement` instead of
|
||||
/// `pep508_rs::Requirement`.
|
||||
/// `uv_pep508::Requirement`.
|
||||
#[derive(Hash, Debug, Clone, Eq, PartialEq)]
|
||||
pub enum UnresolvedRequirement {
|
||||
/// The uv-specific superset over PEP 508 requirements specifier incorporating
|
|
@ -1,7 +1,7 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use pep508_rs::VerbatimUrl;
|
||||
use uv_normalize::PackageName;
|
||||
use uv_pep508::VerbatimUrl;
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::{
|
||||
|
@ -20,7 +20,7 @@ pub trait Name {
|
|||
/// Metadata that can be resolved from a requirements specification alone (i.e., prior to building
|
||||
/// or installing the distribution).
|
||||
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.
|
||||
fn version_or_url(&self) -> VersionOrUrlRef;
|
||||
|
|
@ -13,22 +13,22 @@ license = { workspace = true }
|
|||
workspace = true
|
||||
|
||||
[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-info = { workspace = true }
|
||||
uv-cache-key = { workspace = true }
|
||||
uv-client = { workspace = true }
|
||||
uv-configuration = { workspace = true }
|
||||
uv-distribution-filename = { workspace = true }
|
||||
uv-distribution-types = { workspace = true }
|
||||
uv-extract = { workspace = true }
|
||||
uv-fs = { workspace = true, features = ["tokio"] }
|
||||
uv-git = { workspace = true }
|
||||
uv-metadata = { 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-warnings = { workspace = true }
|
||||
uv-workspace = { workspace = true }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use distribution_types::Hashed;
|
||||
use pypi_types::HashDigest;
|
||||
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.
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
|
|
|
@ -14,19 +14,19 @@ use tokio_util::compat::FuturesAsyncReadCompatExt;
|
|||
use tracing::{debug, info_span, instrument, warn, Instrument};
|
||||
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_info::{CacheInfo, Timestamp};
|
||||
use uv_client::{
|
||||
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_fs::write_atomic;
|
||||
use uv_platform_tags::Tags;
|
||||
use uv_pypi_types::HashDigest;
|
||||
use uv_types::BuildContext;
|
||||
|
||||
use crate::archive::Archive;
|
||||
|
@ -148,7 +148,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
|
|||
let wheel = wheels.best_wheel();
|
||||
let url = match &wheel.file.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(),
|
||||
};
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use std::path::{Path, PathBuf};
|
||||
|
||||
use crate::Error;
|
||||
use distribution_filename::WheelFilename;
|
||||
use distribution_types::{CachedDist, Dist, Hashed};
|
||||
use pypi_types::{HashDigest, ResolutionMetadata};
|
||||
use uv_distribution_filename::WheelFilename;
|
||||
use uv_distribution_types::{CachedDist, Dist, Hashed};
|
||||
use uv_metadata::read_flat_wheel_metadata;
|
||||
use uv_pypi_types::{HashDigest, ResolutionMetadata};
|
||||
|
||||
use uv_cache_info::CacheInfo;
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@ use url::Url;
|
|||
use zip::result::ZipError;
|
||||
|
||||
use crate::metadata::MetadataError;
|
||||
use distribution_filename::WheelFilenameError;
|
||||
use pep440_rs::Version;
|
||||
use pypi_types::{HashDigest, ParsedUrlError};
|
||||
use uv_client::WrappedReqwestError;
|
||||
use uv_distribution_filename::WheelFilenameError;
|
||||
use uv_fs::Simplified;
|
||||
use uv_normalize::PackageName;
|
||||
use uv_pep440::Version;
|
||||
use uv_pypi_types::{HashDigest, ParsedUrlError};
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum Error {
|
||||
|
@ -26,7 +26,7 @@ pub enum Error {
|
|||
#[error(transparent)]
|
||||
ParsedUrl(#[from] ParsedUrlError),
|
||||
#[error(transparent)]
|
||||
JoinRelativeUrl(#[from] pypi_types::JoinRelativeError),
|
||||
JoinRelativeUrl(#[from] uv_pypi_types::JoinRelativeError),
|
||||
#[error("Expected a file URL, but received: {0}")]
|
||||
NonFileUrl(Url),
|
||||
#[error(transparent)]
|
||||
|
@ -65,7 +65,7 @@ pub enum Error {
|
|||
#[error("Package metadata version `{metadata}` does not match given version `{given}`")]
|
||||
VersionMismatch { given: Version, metadata: Version },
|
||||
#[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())]
|
||||
WheelMetadata(PathBuf, #[source] Box<uv_metadata::Error>),
|
||||
#[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")]
|
||||
MissingRequiresTxt,
|
||||
#[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`")]
|
||||
RequiresTxt(#[source] pypi_types::MetadataError),
|
||||
RequiresTxt(#[source] uv_pypi_types::MetadataError),
|
||||
#[error("The source distribution is missing a `pyproject.toml` file")]
|
||||
MissingPyprojectToml,
|
||||
#[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}")]
|
||||
UnsupportedScheme(String),
|
||||
#[error(transparent)]
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
use crate::index::cached_wheel::CachedWheel;
|
||||
use crate::source::{HttpRevisionPointer, LocalRevisionPointer, HTTP_REVISION, LOCAL_REVISION};
|
||||
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_info::CacheInfo;
|
||||
use uv_cache_key::cache_digest;
|
||||
use uv_configuration::ConfigSettings;
|
||||
use uv_distribution_types::{
|
||||
DirectUrlSourceDist, DirectorySourceDist, GitSourceDist, Hashed, PathSourceDist,
|
||||
};
|
||||
use uv_fs::symlinks;
|
||||
use uv_platform_tags::Tags;
|
||||
use uv_types::HashStrategy;
|
||||
|
||||
/// 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() {
|
||||
cache_shard
|
||||
} else {
|
||||
cache_shard.shard(cache_key::cache_digest(self.build_configuration))
|
||||
cache_shard.shard(cache_digest(self.build_configuration))
|
||||
};
|
||||
|
||||
Ok(self.find(&cache_shard))
|
||||
|
@ -102,7 +103,7 @@ impl<'a> BuiltWheelIndex<'a> {
|
|||
let cache_shard = if self.build_configuration.is_empty() {
|
||||
cache_shard
|
||||
} else {
|
||||
cache_shard.shard(cache_key::cache_digest(self.build_configuration))
|
||||
cache_shard.shard(cache_digest(self.build_configuration))
|
||||
};
|
||||
|
||||
Ok(self
|
||||
|
@ -150,7 +151,7 @@ impl<'a> BuiltWheelIndex<'a> {
|
|||
let cache_shard = if self.build_configuration.is_empty() {
|
||||
cache_shard
|
||||
} else {
|
||||
cache_shard.shard(cache_key::cache_digest(self.build_configuration))
|
||||
cache_shard.shard(cache_digest(self.build_configuration))
|
||||
};
|
||||
|
||||
Ok(self
|
||||
|
@ -176,7 +177,7 @@ impl<'a> BuiltWheelIndex<'a> {
|
|||
let cache_shard = if self.build_configuration.is_empty() {
|
||||
cache_shard
|
||||
} else {
|
||||
cache_shard.shard(cache_key::cache_digest(self.build_configuration))
|
||||
cache_shard.shard(cache_digest(self.build_configuration))
|
||||
};
|
||||
|
||||
self.find(&cache_shard)
|
||||
|
|
|
@ -2,12 +2,12 @@ use std::path::Path;
|
|||
|
||||
use crate::archive::Archive;
|
||||
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_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)]
|
||||
pub struct CachedWheel {
|
||||
|
|
|
@ -2,11 +2,11 @@ use std::collections::hash_map::Entry;
|
|||
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use distribution_types::{CachedRegistryDist, Hashed, IndexLocations, IndexUrl};
|
||||
use platform_tags::Tags;
|
||||
use uv_cache::{Cache, CacheBucket, WheelCache};
|
||||
use uv_distribution_types::{CachedRegistryDist, Hashed, IndexLocations, IndexUrl};
|
||||
use uv_fs::{directories, files, symlinks};
|
||||
use uv_normalize::PackageName;
|
||||
use uv_platform_tags::Tags;
|
||||
use uv_types::HashStrategy;
|
||||
|
||||
use crate::index::cached_wheel::CachedWheel;
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::rc::Rc;
|
|||
use rustc_hash::FxHashMap;
|
||||
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.
|
||||
#[derive(Debug, Default)]
|
||||
|
|
|
@ -5,12 +5,12 @@ use std::path::{Path, PathBuf};
|
|||
use thiserror::Error;
|
||||
use url::Url;
|
||||
|
||||
use distribution_filename::DistExtension;
|
||||
use pep440_rs::VersionSpecifiers;
|
||||
use pep508_rs::{MarkerTree, VerbatimUrl, VersionOrUrl};
|
||||
use pypi_types::{ParsedUrlError, Requirement, RequirementSource, VerbatimParsedUrl};
|
||||
use uv_distribution_filename::DistExtension;
|
||||
use uv_git::GitReference;
|
||||
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_workspace::pyproject::{PyProjectToml, Source, Sources};
|
||||
use uv_workspace::Workspace;
|
||||
|
@ -29,7 +29,7 @@ enum Origin {
|
|||
impl LoweredRequirement {
|
||||
/// Combine `project.dependencies` or `project.optional-dependencies` with `tool.uv.sources`.
|
||||
pub(crate) fn from_requirement<'data>(
|
||||
requirement: pep508_rs::Requirement<VerbatimParsedUrl>,
|
||||
requirement: uv_pep508::Requirement<VerbatimParsedUrl>,
|
||||
project_name: &'data PackageName,
|
||||
project_dir: &'data Path,
|
||||
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).
|
||||
pub fn from_non_workspace_requirement<'data>(
|
||||
requirement: pep508_rs::Requirement<VerbatimParsedUrl>,
|
||||
requirement: uv_pep508::Requirement<VerbatimParsedUrl>,
|
||||
dir: &'data Path,
|
||||
sources: &'data BTreeMap<PackageName, Sources>,
|
||||
) -> impl Iterator<Item = Result<LoweredRequirement, LoweringError>> + 'data {
|
||||
|
@ -360,7 +360,7 @@ pub enum LoweringError {
|
|||
#[error(transparent)]
|
||||
InvalidUrl(#[from] url::ParseError),
|
||||
#[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`")]
|
||||
ConflictingUrls,
|
||||
#[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`].
|
||||
fn registry_source(
|
||||
requirement: &pep508_rs::Requirement<VerbatimParsedUrl>,
|
||||
requirement: &uv_pep508::Requirement<VerbatimParsedUrl>,
|
||||
index: String,
|
||||
) -> Result<RequirementSource, LoweringError> {
|
||||
match &requirement.version_or_url {
|
||||
|
|
|
@ -3,10 +3,10 @@ use std::path::Path;
|
|||
|
||||
use thiserror::Error;
|
||||
|
||||
use pep440_rs::{Version, VersionSpecifiers};
|
||||
use pypi_types::{HashDigest, ResolutionMetadata};
|
||||
use uv_configuration::SourceStrategy;
|
||||
use uv_normalize::{ExtraName, GroupName, PackageName};
|
||||
use uv_pep440::{Version, VersionSpecifiers};
|
||||
use uv_pypi_types::{HashDigest, ResolutionMetadata};
|
||||
use uv_workspace::WorkspaceError;
|
||||
|
||||
pub use crate::metadata::lowering::LoweredRequirement;
|
||||
|
@ -32,10 +32,10 @@ pub struct Metadata {
|
|||
pub name: PackageName,
|
||||
pub version: Version,
|
||||
// Optional fields
|
||||
pub requires_dist: Vec<pypi_types::Requirement>,
|
||||
pub requires_dist: Vec<uv_pypi_types::Requirement>,
|
||||
pub requires_python: Option<VersionSpecifiers>,
|
||||
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 {
|
||||
|
@ -48,7 +48,7 @@ impl Metadata {
|
|||
requires_dist: metadata
|
||||
.requires_dist
|
||||
.into_iter()
|
||||
.map(pypi_types::Requirement::from)
|
||||
.map(uv_pypi_types::Requirement::from)
|
||||
.collect(),
|
||||
requires_python: metadata.requires_python,
|
||||
provides_extras: metadata.provides_extras,
|
||||
|
@ -70,7 +70,7 @@ impl Metadata {
|
|||
provides_extras,
|
||||
dev_dependencies,
|
||||
} = RequiresDist::from_project_maybe_workspace(
|
||||
pypi_types::RequiresDist {
|
||||
uv_pypi_types::RequiresDist {
|
||||
name: metadata.name,
|
||||
requires_dist: metadata.requires_dist,
|
||||
provides_extras: metadata.provides_extras,
|
||||
|
|
|
@ -11,21 +11,21 @@ use uv_workspace::{DiscoveryOptions, ProjectWorkspace};
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct RequiresDist {
|
||||
pub name: PackageName,
|
||||
pub requires_dist: Vec<pypi_types::Requirement>,
|
||||
pub requires_dist: Vec<uv_pypi_types::Requirement>,
|
||||
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 {
|
||||
/// Lower without considering `tool.uv` in `pyproject.toml`, used for index and other archive
|
||||
/// dependencies.
|
||||
pub fn from_metadata23(metadata: pypi_types::RequiresDist) -> Self {
|
||||
pub fn from_metadata23(metadata: uv_pypi_types::RequiresDist) -> Self {
|
||||
Self {
|
||||
name: metadata.name,
|
||||
requires_dist: metadata
|
||||
.requires_dist
|
||||
.into_iter()
|
||||
.map(pypi_types::Requirement::from)
|
||||
.map(uv_pypi_types::Requirement::from)
|
||||
.collect(),
|
||||
provides_extras: metadata.provides_extras,
|
||||
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
|
||||
/// dependencies.
|
||||
pub async fn from_project_maybe_workspace(
|
||||
metadata: pypi_types::RequiresDist,
|
||||
metadata: uv_pypi_types::RequiresDist,
|
||||
install_path: &Path,
|
||||
sources: SourceStrategy,
|
||||
) -> Result<Self, MetadataError> {
|
||||
|
@ -52,7 +52,7 @@ impl RequiresDist {
|
|||
}
|
||||
|
||||
fn from_project_workspace(
|
||||
metadata: pypi_types::RequiresDist,
|
||||
metadata: uv_pypi_types::RequiresDist,
|
||||
project_workspace: &ProjectWorkspace,
|
||||
source_strategy: SourceStrategy,
|
||||
) -> Result<Self, MetadataError> {
|
||||
|
@ -103,7 +103,7 @@ impl RequiresDist {
|
|||
.collect::<Result<Vec<_>, _>>()?,
|
||||
SourceStrategy::Disabled => dev_dependencies
|
||||
.into_iter()
|
||||
.map(pypi_types::Requirement::from)
|
||||
.map(uv_pypi_types::Requirement::from)
|
||||
.collect(),
|
||||
};
|
||||
if dev_dependencies.is_empty() {
|
||||
|
@ -135,7 +135,7 @@ impl RequiresDist {
|
|||
.collect::<Result<Vec<_>, _>>()?,
|
||||
SourceStrategy::Disabled => requires_dist
|
||||
.into_iter()
|
||||
.map(pypi_types::Requirement::from)
|
||||
.map(uv_pypi_types::Requirement::from)
|
||||
.collect(),
|
||||
};
|
||||
|
||||
|
@ -188,7 +188,7 @@ mod test {
|
|||
},
|
||||
)
|
||||
.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(
|
||||
requires_dist,
|
||||
&project_workspace,
|
||||
|
|
|
@ -2,8 +2,8 @@ use std::sync::Arc;
|
|||
|
||||
use url::Url;
|
||||
|
||||
use distribution_types::BuildableSource;
|
||||
use pep508_rs::PackageName;
|
||||
use uv_distribution_types::BuildableSource;
|
||||
use uv_pep508::PackageName;
|
||||
|
||||
pub trait Reporter: Send + Sync {
|
||||
/// Callback to invoke when a source distribution build is kicked off.
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
use std::path::PathBuf;
|
||||
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_info::CacheInfo;
|
||||
use uv_distribution_filename::WheelFilename;
|
||||
use uv_distribution_types::Hashed;
|
||||
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.
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
@ -12,28 +12,29 @@ use crate::reporter::Facade;
|
|||
use crate::source::built_wheel_metadata::BuiltWheelMetadata;
|
||||
use crate::source::revision::Revision;
|
||||
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 futures::{FutureExt, TryStreamExt};
|
||||
use platform_tags::Tags;
|
||||
use pypi_types::{HashDigest, Metadata12, RequiresTxt, ResolutionMetadata};
|
||||
use reqwest::Response;
|
||||
use tokio_util::compat::FuturesAsyncReadCompatExt;
|
||||
use tracing::{debug, info_span, instrument, warn, Instrument};
|
||||
use url::Url;
|
||||
use uv_cache::{Cache, CacheBucket, CacheEntry, CacheShard, Removal, WheelCache};
|
||||
use uv_cache_info::CacheInfo;
|
||||
use uv_cache_key::cache_digest;
|
||||
use uv_client::{
|
||||
CacheControl, CachedClientError, Connectivity, DataWithCachePolicy, RegistryClient,
|
||||
};
|
||||
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_fs::{rename_with_retry, write_atomic, LockedFile};
|
||||
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 zip::ZipArchive;
|
||||
|
||||
|
@ -94,7 +95,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
|
||||
let url = match &dist.file.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(),
|
||||
};
|
||||
|
@ -253,7 +254,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
|
||||
let url = match &dist.file.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(),
|
||||
};
|
||||
|
@ -432,7 +433,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
let cache_shard = if config_settings.is_empty() {
|
||||
cache_shard
|
||||
} 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.
|
||||
|
@ -566,7 +567,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
let cache_shard = if config_settings.is_empty() {
|
||||
cache_shard
|
||||
} 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.
|
||||
|
@ -727,7 +728,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
let cache_shard = if config_settings.is_empty() {
|
||||
cache_shard
|
||||
} 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.
|
||||
|
@ -858,7 +859,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
let cache_shard = if config_settings.is_empty() {
|
||||
cache_shard
|
||||
} else {
|
||||
cache_shard.shard(cache_key::cache_digest(config_settings))
|
||||
cache_shard.shard(cache_digest(config_settings))
|
||||
};
|
||||
|
||||
// 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() {
|
||||
cache_shard
|
||||
} 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.
|
||||
|
@ -1113,7 +1114,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
let cache_shard = if config_settings.is_empty() {
|
||||
cache_shard
|
||||
} else {
|
||||
cache_shard.shard(cache_key::cache_digest(config_settings))
|
||||
cache_shard.shard(cache_digest(config_settings))
|
||||
};
|
||||
|
||||
// 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() {
|
||||
cache_shard
|
||||
} 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.
|
||||
|
@ -1365,7 +1366,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
let cache_shard = if config_settings.is_empty() {
|
||||
cache_shard
|
||||
} else {
|
||||
cache_shard.shard(cache_key::cache_digest(config_settings))
|
||||
cache_shard.shard(cache_digest(config_settings))
|
||||
};
|
||||
|
||||
// Otherwise, we need to build a wheel.
|
||||
|
@ -1699,10 +1700,10 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
Err(
|
||||
err @ (Error::MissingPyprojectToml
|
||||
| Error::PyprojectToml(
|
||||
pypi_types::MetadataError::Pep508Error(_)
|
||||
| pypi_types::MetadataError::DynamicField(_)
|
||||
| pypi_types::MetadataError::FieldNotFound(_)
|
||||
| pypi_types::MetadataError::PoetrySyntax,
|
||||
uv_pypi_types::MetadataError::Pep508Error(_)
|
||||
| uv_pypi_types::MetadataError::DynamicField(_)
|
||||
| uv_pypi_types::MetadataError::FieldNotFound(_)
|
||||
| uv_pypi_types::MetadataError::PoetrySyntax,
|
||||
)),
|
||||
) => {
|
||||
debug!("No static `pyproject.toml` available for: {source} ({err:?})");
|
||||
|
@ -1729,10 +1730,10 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
Err(
|
||||
err @ (Error::MissingPkgInfo
|
||||
| Error::PkgInfo(
|
||||
pypi_types::MetadataError::Pep508Error(_)
|
||||
| pypi_types::MetadataError::DynamicField(_)
|
||||
| pypi_types::MetadataError::FieldNotFound(_)
|
||||
| pypi_types::MetadataError::UnsupportedMetadataVersion(_),
|
||||
uv_pypi_types::MetadataError::Pep508Error(_)
|
||||
| uv_pypi_types::MetadataError::DynamicField(_)
|
||||
| uv_pypi_types::MetadataError::FieldNotFound(_)
|
||||
| uv_pypi_types::MetadataError::UnsupportedMetadataVersion(_),
|
||||
)),
|
||||
) => {
|
||||
debug!("No static `PKG-INFO` available for: {source} ({err:?})");
|
||||
|
@ -1755,14 +1756,14 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
| Error::MissingRequiresTxt
|
||||
| Error::MissingPkgInfo
|
||||
| Error::RequiresTxt(
|
||||
pypi_types::MetadataError::Pep508Error(_)
|
||||
| pypi_types::MetadataError::RequiresTxtContents(_),
|
||||
uv_pypi_types::MetadataError::Pep508Error(_)
|
||||
| uv_pypi_types::MetadataError::RequiresTxtContents(_),
|
||||
)
|
||||
| Error::PkgInfo(
|
||||
pypi_types::MetadataError::Pep508Error(_)
|
||||
| pypi_types::MetadataError::DynamicField(_)
|
||||
| pypi_types::MetadataError::FieldNotFound(_)
|
||||
| pypi_types::MetadataError::UnsupportedMetadataVersion(_),
|
||||
uv_pypi_types::MetadataError::Pep508Error(_)
|
||||
| uv_pypi_types::MetadataError::DynamicField(_)
|
||||
| uv_pypi_types::MetadataError::FieldNotFound(_)
|
||||
| uv_pypi_types::MetadataError::UnsupportedMetadataVersion(_),
|
||||
)),
|
||||
) => {
|
||||
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.
|
||||
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.
|
||||
let pyproject_toml = project_root.join("pyproject.toml");
|
||||
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.
|
||||
let requires_dist =
|
||||
pypi_types::RequiresDist::parse_pyproject_toml(&content).map_err(Error::PyprojectToml)?;
|
||||
let requires_dist = uv_pypi_types::RequiresDist::parse_pyproject_toml(&content)
|
||||
.map_err(Error::PyprojectToml)?;
|
||||
|
||||
Ok(requires_dist)
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use distribution_types::Hashed;
|
||||
use serde::{Deserialize, Serialize};
|
||||
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.
|
||||
///
|
||||
|
|
|
@ -13,8 +13,8 @@ license = { workspace = true }
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
distribution-filename = { workspace = true }
|
||||
pypi-types = { workspace = true }
|
||||
uv-distribution-filename = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
|
||||
async-compression = { workspace = true, features = ["bzip2", "gzip", "zstd", "xz"] }
|
||||
async_zip = { workspace = true }
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::task::{Context, Poll};
|
|||
use sha2::Digest;
|
||||
use tokio::io::{AsyncReadExt, ReadBuf};
|
||||
|
||||
use pypi_types::{HashAlgorithm, HashDigest};
|
||||
use uv_pypi_types::{HashAlgorithm, HashDigest};
|
||||
|
||||
pub struct Sha256Reader<'a, R> {
|
||||
reader: R,
|
||||
|
|
|
@ -2,11 +2,11 @@ use std::path::Path;
|
|||
use std::pin::Pin;
|
||||
|
||||
use crate::Error;
|
||||
use distribution_filename::SourceDistExtension;
|
||||
use futures::StreamExt;
|
||||
use rustc_hash::FxHashSet;
|
||||
use tokio_util::compat::{FuturesAsyncReadCompatExt, TokioAsyncReadCompatExt};
|
||||
use tracing::warn;
|
||||
use uv_distribution_filename::SourceDistExtension;
|
||||
|
||||
const DEFAULT_BUF_SIZE: usize = 128 * 1024;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ license = { workspace = true }
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
cache-key = { workspace = true }
|
||||
uv-cache-key = { workspace = true }
|
||||
uv-fs = { workspace = true, features = ["tokio"] }
|
||||
uv-auth = { workspace = true }
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use cache_key::RepositoryUrl;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, LazyLock, RwLock};
|
||||
use tracing::trace;
|
||||
use url::Url;
|
||||
use uv_auth::Credentials;
|
||||
use uv_cache_key::RepositoryUrl;
|
||||
|
||||
/// Global authentication cache for a uv invocation.
|
||||
///
|
||||
|
|
|
@ -4,11 +4,11 @@ use std::sync::Arc;
|
|||
|
||||
use tracing::debug;
|
||||
|
||||
use cache_key::RepositoryUrl;
|
||||
use dashmap::mapref::one::Ref;
|
||||
use dashmap::DashMap;
|
||||
use fs_err::tokio as fs;
|
||||
use reqwest_middleware::ClientWithMiddleware;
|
||||
use uv_cache_key::{cache_digest, RepositoryUrl};
|
||||
use uv_fs::LockedFile;
|
||||
|
||||
use crate::{Fetch, GitReference, GitSha, GitSource, GitUrl, Reporter};
|
||||
|
@ -65,7 +65,7 @@ impl GitResolver {
|
|||
fs::create_dir_all(&lock_dir).await?;
|
||||
let repository_url = RepositoryUrl::new(url.repository());
|
||||
let _lock = LockedFile::acquire(
|
||||
lock_dir.join(cache_key::cache_digest(&repository_url)),
|
||||
lock_dir.join(cache_digest(&repository_url)),
|
||||
&repository_url,
|
||||
)
|
||||
.await?;
|
||||
|
|
|
@ -10,7 +10,7 @@ use reqwest_middleware::ClientWithMiddleware;
|
|||
use tracing::{debug, instrument};
|
||||
use url::Url;
|
||||
|
||||
use cache_key::{cache_digest, RepositoryUrl};
|
||||
use uv_cache_key::{cache_digest, RepositoryUrl};
|
||||
|
||||
use crate::git::GitRemote;
|
||||
use crate::{GitOid, GitSha, GitUrl, GIT_STORE};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "install-wheel-rs"
|
||||
name = "uv-install-wheel"
|
||||
version = "0.0.1"
|
||||
publish = false
|
||||
description = "Takes a wheel and installs it."
|
||||
|
@ -20,13 +20,13 @@ workspace = true
|
|||
name = "install_wheel_rs"
|
||||
|
||||
[dependencies]
|
||||
distribution-filename = { workspace = true }
|
||||
pep440_rs = { workspace = true }
|
||||
platform-tags = { workspace = true }
|
||||
pypi-types = { workspace = true }
|
||||
uv-cache-info = { workspace = true }
|
||||
uv-distribution-filename = { workspace = true }
|
||||
uv-fs = { workspace = true }
|
||||
uv-normalize = { workspace = true }
|
||||
uv-pep440 = { workspace = true }
|
||||
uv-platform-tags = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
uv-warnings = { workspace = true }
|
||||
|
||||
clap = { workspace = true, optional = true, features = ["derive"] }
|
|
@ -7,12 +7,12 @@ use platform_info::PlatformInfoError;
|
|||
use thiserror::Error;
|
||||
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};
|
||||
use uv_fs::Simplified;
|
||||
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 mod linker;
|
||||
|
@ -55,7 +55,7 @@ pub enum Error {
|
|||
InvalidWheel(String),
|
||||
/// Doesn't follow file name schema
|
||||
#[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).
|
||||
#[error("Failed to read {0} from zip file")]
|
||||
Zip(String, #[source] ZipError),
|
||||
|
@ -90,7 +90,7 @@ pub enum Error {
|
|||
#[error("Invalid package name")]
|
||||
InvalidName(#[from] uv_normalize::InvalidNameError),
|
||||
#[error("Invalid package version")]
|
||||
InvalidVersion(#[from] pep440_rs::VersionParseError),
|
||||
InvalidVersion(#[from] uv_pep440::VersionParseError),
|
||||
#[error("Wheel package name does not match filename: {0} != {1}")]
|
||||
MismatchedName(PackageName, PackageName),
|
||||
#[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
Loading…
Add table
Add a link
Reference in a new issue