Skip to content

Commit

Permalink
fix git dependencies with recursive git dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Nov 7, 2024
1 parent acb1ada commit 0c83438
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 23 deletions.
58 changes: 58 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 23 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ uv-normalize = { workspace = true }
uv-python = { workspace = true }
uv-resolver = { workspace = true }
uv-types = { workspace = true }
uv-requirements = { workspace = true}
xxhash-rust = { workspace = true }
zip = { workspace = true, features = ["deflate", "time"] }
zstd = { workspace = true }
Expand Down Expand Up @@ -354,24 +355,25 @@ reqwest-retry = { git = "https://github.com/TrueLayer/reqwest-middleware", rev =


# Change these lines if you want a patched version of uv
# [patch.'https://github.com/astral-sh/uv']
# pep440_rs = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# pep508_rs = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# uv-build = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# uv-cache = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# uv-client = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# uv-configuration = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# uv-git = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# uv-dispatch = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# uv-distribution = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# uv-installer = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# uv-interpreter = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# uv-normalize = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# uv-resolver = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# uv-types = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# distribution-filename = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# distribution-types = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# install-wheel-rs = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# platform-tags = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# pypi-types = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
# requirements-txt = { git = "https://github.com/astral-sh/uv", rev = "65b17f6e81125064ea04c5cfef685516ab660cf5" }
[patch.'https://github.com/astral-sh/uv']
# uv-cache = { path = "../uv/crates/uv-cache" }
# uv-pep508 = { path = "../uv/crates/uv-pep508" }
# uv-pep440 = { path = "../uv/crates/uv-pep440" }
# uv-cache-info = { path = "../uv/crates/uv-cache-info" }
# uv-client = { path = "../uv/crates/uv-client" }
# uv-configuration = { path = "../uv/crates/uv-configuration" }
# uv-git = { path = "../uv/crates/uv-git" }
# uv-dispatch = { path = "../uv/crates/uv-dispatch" }
# uv-distribution = { path = "../uv/crates/uv-distribution" }
# uv-installer = { path = "../uv/crates/uv-installer" }
# uv-normalize = { path = "../uv/crates/uv-normalize" }
# uv-resolver = { path = "../uv/crates/uv-resolver" }
# uv-types = { path = "../uv/crates/uv-types" }
# uv-distribution-filename = { path = "../uv/crates/uv-distribution-filename" }
# uv-distribution-types = { path = "../uv/crates/uv-distribution-types" }
# uv-install-wheel = { path = "../uv/crates/uv-install-wheel" }
# uv-platform-tags = { path = "../uv/crates/uv-platform-tags" }
# uv-pypi-types = { path = "../uv/crates/uv-pypi-types" }
# uv-requirements = { path = "../uv/crates/uv-requirements" }
# uv-requirements-txt = { path = "../uv/crates/uv-requirements-txt" }
# uv-python = { path = "../uv/crates/uv-python" }
28 changes: 26 additions & 2 deletions src/lock_file/resolve/pypi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use uv_git::GitResolver;
use uv_install_wheel::linker::LinkMode;
use uv_pypi_types::{HashAlgorithm, HashDigest, RequirementSource};
use uv_python::{Interpreter, PythonEnvironment, PythonVersion};
use uv_requirements::LookaheadResolver;
use uv_resolver::{
AllowedYanks, DefaultResolverProvider, FlatIndex, InMemoryIndex, Manifest, Options, Preference,
Preferences, PythonRequirement, Resolver, ResolverEnvironment,
Expand Down Expand Up @@ -351,16 +352,39 @@ pub async fn resolve_pypi(
.into_diagnostic()?;

let resolver_env = ResolverEnvironment::specific(marker_environment.into());

let constraints = Constraints::from_requirements(constraints.iter().cloned());
let lookahead_index = InMemoryIndex::default();
let lookaheads = LookaheadResolver::new(
&requirements,
&constraints,
&Overrides::default(),
&[],
&context.hash_strategy,
&lookahead_index,
DistributionDatabase::new(
&registry_client,
&build_dispatch,
context.concurrency.downloads,
),
)
.with_reporter(UvReporter::new(
UvReporterOptions::new().with_existing(pb.clone()),
))
.resolve(&resolver_env)
.await
.into_diagnostic()?;

let manifest = Manifest::new(
requirements,
Constraints::from_requirements(constraints.iter().cloned()),
constraints,
Overrides::default(),
Default::default(),
Preferences::from_iter(preferences, &resolver_env),
None,
None,
uv_resolver::Exclusions::None,
Vec::new(),
lookaheads,
);

let interpreter_version = interpreter.python_version();
Expand Down
27 changes: 27 additions & 0 deletions src/uv_reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,30 @@ impl uv_resolver::ResolverReporter for UvReporter {

fn on_download_complete(&self, _name: &PackageName, _id: usize) {}
}

impl uv_distribution::Reporter for UvReporter {
fn on_build_start(&self, dist: &BuildableSource) -> usize {
self.start_sync(format!("building {}", dist,))
}

fn on_build_complete(&self, _dist: &BuildableSource, id: usize) {
self.finish(id);
}

fn on_checkout_start(&self, url: &url::Url, _rev: &str) -> usize {
self.start_sync(format!("cloning {}", url))
}

fn on_checkout_complete(&self, _url: &url::Url, _rev: &str, index: usize) {
self.finish(index);
}

// TODO: figure out how to display this nicely
fn on_download_start(&self, _name: &PackageName, _size: Option<u64>) -> usize {
0
}

fn on_download_progress(&self, _id: usize, _bytes: u64) {}

fn on_download_complete(&self, _name: &PackageName, _id: usize) {}
}

0 comments on commit 0c83438

Please sign in to comment.