-
Notifications
You must be signed in to change notification settings - Fork 856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uv add workspace fails misteriously from git but not locally #8887
Comments
Are you on a fairly recent version of uv? \cc @konstin |
Separately @konstin any idea how we're getting that specific error when the URLs are the same...? |
❯ uv --version Here is the gist of the error when running in verbose mode. |
@charliermarsh I cleaned up the workspace to publish it. mkdir test
cd test
uv init
uv add git+https://github.com/PhilipVinc/uvtest |
It looks like while the
|
For a git dependency that is a workspace, we first clone the repository to the cache dir, then do workspace discovery inside the cache directory. That means if you depend on A in a git repo and A depends on B in that same git repo, we get B as a directory. If you also depend on B from that git repo, we get the conflict. I had hoped to have fixed that in #8665 by rewriting the directory back to a git URL, but apparently this branch is still wrong. |
I could maybe take a swing at this but could use some pointers on where to look for things |
The workspace section of |
@konstin I'm not very familiar with rust, but I think that the condition you linked to above is correct. I'm unsure how to proceed from here, however.. |
Ok, some more debugging lead me to the conclusion that:
By changing those lines to if let Some(metadata) = read_cached_metadata(&metadata_entry).await? {
let path = if let Some(subdirectory) = resource.subdirectory {
Cow::Owned(fetch.path().join(subdirectory))
} else {
Cow::Borrowed(fetch.path())
};
let git_member = GitWorkspaceMember {
fetch_root: fetch.path(),
git_source: resource,
};
return Ok(ArchiveMetadata::from(
Metadata::from_workspace(
metadata,
&path,
Some(&git_member),
self.build_context.locations(),
self.build_context.sources(),
self.build_context.bounds(),
) my ignorant test case ( |
Ah! I think I understand.
The error stems when any among repository A or B have a dynamic |
Was looking at this again, I don't see any immediate problems with this, and doesn't seem to cause any issues with the test suite (I do have 3 failing tests locally but 2 are due to rate limiting and the last one fails even without the change, so I'm assuming it's irrelevant). @konstin wdyt? |
I'd be happy to review a PR (or at least, it'd probably be easier for me to comment on the changes as a diff since there's a lot of context here). |
Threw something up at #9388. If you think the PR makes sense I can get into writing some tests |
The PR code makes sense to me |
## Summary Include the `git_member` when fetching metadata from cache. h/t to @PhilipVinc for the suggested fix Resolves #8887 ## Test Plan Pending --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
I tried to add as a dependency to a project a workspace that is found on git by doing
this fails with the error
Instead, if I do the same but from a cloned version of the workspace, it just works
While the workspace is private, the structure is something that looks like
However the error is not very telling, and I do not understand what I can do to fix it.
The text was updated successfully, but these errors were encountered: