-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
I'm currently evaluating uv for our Python teams. So far I'm very impressed with the overall snappiness (compared to Pipenv), thank you very much for the good work so far. Unfortunately I ran into an issue when dealing with private packages from our Gitlab.
I don't have knowledge about uv's internal workings, but my guess is that the authentication credentials aren't stored properly at some point and are then missing for successive operations.
$ uv --version
uv 0.4.10
$ uname -sp
Linux x86_64
First, I'm adding the dependency to the project:
$ RUST_LOG=uv=trace uv add "git+https://user:[email protected]/group/project.git" --tag "v2024.8.6"
[...]
DEBUG Fetching source distribution from Git: https://user:[email protected]/group/project.git
TRACE Checking lock for `https://gitlab.mycompany.com/group/project` at `/tmp/.tmp5Co2Yg/git-v0/locks/924509151ecc8240`
DEBUG Acquired lock for `https://gitlab.mycompany.com/group/project`
DEBUG Updating Git source `https://user:[email protected]/group/project.git`
DEBUG Performing a Git fetch for: https://user:[email protected]/group/project.git
DEBUG reset /tmp/.tmp5Co2Yg/git-v0/checkouts/924509151ecc8240/9bf0934 to 9bf093425188c4feaa7f86a78569b2fbbf5ba1a0
DEBUG Released lock at `/tmp/.tmp5Co2Yg/git-v0/locks/924509151ecc8240`
TRACE Checking lock for `/tmp/.tmp5Co2Yg/built-wheels-v3/git/8742abde34b47f9d/9bf093425188c4fe` at `/tmp/.tmp5Co2Yg/built-wheels-v3/git/8742abde34b47f9d/9bf093425188c4fe/.lock`
DEBUG Acquired lock for `/tmp/.tmp5Co2Yg/built-wheels-v3/git/8742abde34b47f9d/9bf093425188c4fe`
DEBUG No static `pyproject.toml` available for: git+https://user:[email protected]/group/project.git (PyprojectToml(DynamicField("version")))
DEBUG No static `PKG-INFO` available for: git+https://user:[email protected]/group/project.git (MissingPkgInfo)
DEBUG No static `egg-info` available for: git+https://user:[email protected]/group/project.git (MissingEggInfo)
DEBUG Preparing metadata for: git+https://user:[email protected]/group/project.git
[...]
Prepared 97 packages in 6.90s
Installed 97 packages in 179ms
[...]
As you can clearly see in the logs the credentials are present and the operation finishes successfully.
The package appears in pyproject.toml
and uv.lock
; note that the stated credentials are missing:
# pyproject.toml
[project]
...
dependencies = [
...
"package",
]
[tool.uv.sources]
bxlog = { git = "https://gitlab.mycompany.com/group/project.git", tag = "v2024.8.6" }
# uv.lock
...
[[package]]
name = "thisproject"
...
dependencies = [
...
{ name = "package" },
]
[package.metadata]
requires-dist = [
...
{ name = "package", git = "https://gitlab.mycompany.com/group/project.git?tag=v2024.8.6" },
]
...
[[package]]
name = "package"
version = "2024.8.6"
source = { git = "https://gitlab.mycompany.com/group/project.git?tag=v2024.8.6#020cae642886a1fce3528366402047d479621904" }
Now, let's simulate another developer checking the project out and installing the dependencies for the first time:
$ rm -rf .venv
$ RUST_LOG=uv=trace uv sync --no-cache
[...]
DEBUG Identified uncached requirement: package @ git+https://gitlab.mycompany.com/group/[email protected]
[...]
DEBUG Fetching source distribution from Git: https://gitlab.mycompany.com/group/package.git
[...]
TRACE Checking lock for `https://gitlab.mycompany.com/group/package` at `/tmp/.tmpcPhaTx/git-v0/locks/924509151ecc8240`
DEBUG Acquired lock for `https://gitlab.mycompany.com/group/package`
[...]
DEBUG Updating Git source `https://gitlab.mycompany.com/group/package.git`
DEBUG Performing a Git fetch for: https://gitlab.mycompany.com/group/package.git
[...]
error: Failed to prepare distributions
Caused by: Failed to fetch wheel: package @ git+https://gitlab.mycompany.com/group/package.git@020cae642886a1fce3528366402047d479621904
Caused by: Git operation failed
Caused by: failed to clone into: /tmp/.tmpcPhaTx/git-v0/db/924509151ecc8240
Caused by: failed to fetch commit `020cae642886a1fce3528366402047d479621904`
Caused by: process didn't exit successfully: `git fetch --force --update-head-ok 'https://gitlab.mycompany.com/group/package.git' '+020cae642886a1fce3528366402047d479621904:refs/remotes/origin/HEAD'` (exit status: 128)
--- stderr
remote:
remote: ========================================================================
remote:
remote: The project you were looking for could not be found or you don't have permission to view it.
remote:
remote: ========================================================================
remote:
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Looking back at pyproject.toml
and uv.lock
that's an understandable response - the username:password
tuple is nowhere to be seen, there simply aren't any credentials that uv could have included in the request.
Interestingly, manually adding the credentials back into the URL in uv.lock
makes uv sync
operate as expected, but after the next uv operation that modifies the lock file (e.g. uv lock --upgrade
) the credentials are lost again, so that's not even a valid workaround.