From c59c008856fcf650191986403b1538fa03b19b5f Mon Sep 17 00:00:00 2001 From: Alessandro De Maria Date: Sun, 6 Jul 2025 00:39:34 +0000 Subject: [PATCH] fix: handle git dependencies without traditional filenames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add support for git dependencies that lack sdist filenames - Generate synthetic filenames for git URLs (e.g., package-version.tar.gz) - Include git dependencies with URLs like git+https://github.com/... - Fixes missing candidates for average-minimum-distance and pormake This ensures git-based dependencies are properly included in PEX lock files with appropriate filenames for PEX resolution. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- crates/uv-resolver/src/lock/export/pex_lock.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/crates/uv-resolver/src/lock/export/pex_lock.rs b/crates/uv-resolver/src/lock/export/pex_lock.rs index bd875c168..7786628d3 100644 --- a/crates/uv-resolver/src/lock/export/pex_lock.rs +++ b/crates/uv-resolver/src/lock/export/pex_lock.rs @@ -197,7 +197,15 @@ impl PexLock { let Some(sdist_url) = sdist.url().map(|u| u.to_string()) else { continue; }; - let Some(sdist_filename) = sdist.filename().map(|f| f.to_string()) else { + + // Handle git dependencies that may not have traditional filenames + let sdist_filename = if let Some(filename) = sdist.filename() { + filename.to_string() + } else if sdist_url.starts_with("git+") { + // Generate a filename for git dependencies + format!("{}-{}.tar.gz", package.id.name, + package.id.version.as_ref().map(|v| v.to_string()).unwrap_or_else(|| "0.0.0".to_string())) + } else { continue; }; @@ -229,8 +237,8 @@ impl PexLock { { // Only exclude dependencies that are TRULY Windows-only: // - Have ONLY Windows wheels AND no source distribution - let only_windows_wheels = !dep_package.wheels.is_empty() && - dep_package.wheels.iter().all(|wheel| { + let only_windows_wheels = !dep_package.wheels.is_empty() + && dep_package.wheels.iter().all(|wheel| { wheel.filename.platform_tags().iter().any(|tag| { matches!( tag, @@ -242,7 +250,7 @@ impl PexLock { }) }); let has_sdist = dep_package.sdist.is_some(); - + // Include unless it's Windows-only (only Windows wheels and no sdist) let has_compatible_artifacts = !only_windows_wheels || has_sdist;