uv: Version conflicts installing lock file when multiple git dependencies rely on another git dependency
When running
uv pip install -r requirements/lock.txt
I get something like
error: Requirements contain conflicting URLs for package `repo1`:
- git+ssh://git@github.com/org/repo1.git
- git+ssh://git@github.com/org/repo1.git@f6f1bd2f14f887fe63b15632d3a18109ab7a8105
The lock file is generated with
uv pip compile -q --generate-hashes pyproject.toml -o requirements/lock.txt
and has
repo2 @ git+ssh://git@github.com/org/repo2.git@f6f1bd2f14f887fe63b15632d3a18109ab7a8106
# via current_project (pyproject.toml)
repo3 @ git+ssh://git@github.com/org/repo3.git@f6f1bd2f14f887fe63b15632d3a18109ab7a8104
# via repo2
repo1 @ git+ssh://git@github.com/org/repo1.git@f6f1bd2f14f887fe63b15632d3a18109ab7a8105
# via
# current_project (pyproject.toml)
# repo2
# repo3
The pyproject.toml file for current_project contains dependencies like the following
dependencies = [
"repo1 @ git+ssh://git@github.com/org/repo1.git",
"repo2 @ git+ssh://git@github.com/org/repo2.git",
]
repo2 and repo3 use setup.pys that have repo1 as a dependency. They require it as follows
# setup.py
def read_requirements(path):
return [
line.strip()
for line in read(path).split("\n")
if not line.startswith(('"', "#", "-"))
]
setup(
...
install_requires=read_requirements("requirements.txt"),
...
)
# requirements.txt
repo1 @ git+ssh://git@github.com/org/repo1.git
I am surprised I get the error
error: Requirements contain conflicting URLs for package `repo1`:
- git+ssh://git@github.com/org/repo1.git
- git+ssh://git@github.com/org/repo1.git@f6f1bd2f14f887fe63b15632d3a18109ab7a8105
I would expect git+ssh://git@github.com/org/repo1.git@f6f1bd2f14f887fe63b15632d3a18109ab7a8105 to satisfy the more general constraint of git+ssh://git@github.com/org/repo1.git.
Currently to get around this, I have to update the lock file in current_project every time repo1 has a new commit on the main branch.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 9
- Comments: 19 (10 by maintainers)
I have a similar situation to @cdb39 , it particularly inconvenient when we want to test a feature branch on A, we have to create out a feature branch on B that refers to that branch with no other changes, and change both references upstream. You can imagine this situation cascading though luckily for us it is only 1 deep.
It would be nice to have a configuration for
uvinpyproject.tomlor even like--no-sourcesat CLI, which is like--no-transitive-sourcesor similar.Thanks for your attention! Lovin this tool.
No problem. I will look at it – feel free to create a separate issue.
Hmm, after trying to make out a repro, I think I was running into an issue because one of the remote deps was stale, when I pushed there the error went away. You should ignore me since I’m no longer blocked, I’m sure you have better things to do 😃 . If it’s useful for anyone else, I made a tiny repo here trying to repro, I think that might be a nice template for someone trying to see how multiple libs and transitive deps might interact
I think what you’re trying to do here should probably work (but agree it doesn’t).