Skip to content

Commit

Permalink
Allow file: URLs to include package names (#9493)
Browse files Browse the repository at this point in the history
## Summary

Closes #9489.
  • Loading branch information
charliermarsh authored Nov 28, 2024
1 parent be651ed commit 8a27d4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions crates/uv-resolver/src/resolution/requirements_txt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl<'dist> RequirementsTxtDist<'dist> {
}
}

// If the URL is not _definitively_ an absolute `file://` URL, write it as a relative path.
// If the URL is not _definitively_ a `file://` URL, write it as a relative path.
if self.dist.is_local() {
if let VersionOrUrlRef::Url(url) = self.dist.version_or_url() {
let given = url.verbatim();
Expand All @@ -72,11 +72,12 @@ impl<'dist> RequirementsTxtDist<'dist> {
{
Some(Cow::Owned(path.to_string()))
} else {
// Ex) `file:///flask-3.0.3-py3-none-any.whl`
None
}
} else {
// Ex) `file:./flask-3.0.3-py3-none-any.whl`
Some(given)
None
}
}
Some(_) => None,
Expand Down
2 changes: 1 addition & 1 deletion crates/uv/tests/it/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2887,7 +2887,7 @@ fn compile_wheel_path_dependency() -> Result<()> {
# via flask
click==8.1.7
# via flask
file:flask-3.0.0-py3-none-any.whl
flask @ file:flask-3.0.0-py3-none-any.whl
# via -r requirements.in
itsdangerous==2.1.2
# via flask
Expand Down

0 comments on commit 8a27d4d

Please sign in to comment.