uv: Slow resolution from Azure DevOps feed

Summary

Hi! I’m trying to find the best way to debug why installing from my work’s package index is so slow. The dependency resolution is the slow part, at 25 sec for our index vs 0.3 sec for pypi.

I have followed the uv instructions for alternative package indexes. We mostly mirror pypi, and for these packages I don’t expect there to be any real difference, except that it should be a bit faster since we probably host fewer packages.

There is no authentication window that I need to click on, everything happens automatically. We’ve added keyring to uv tool with uv tool install keyring --with artifacts-keyring.

Summary logs

# From pypi
❯ uv pip install pandas numpy scikit-learn --no-cache
Resolved 10 packages in 379ms
Prepared 10 packages in 2.44s
Installed 10 packages in 617ms
# (package versions printed here)
# From our index
uv pip install pandas numpy scikit-learn --no-cache --keyring-provider=subprocess --index-url=<redacted>
⠴ Resolving dependencies...                                                                                                                                                                                  [Information] [CredentialProvider]VstsCredentialProvider - Acquired bearer token using 'REDACTED'
[Information] [CredentialProvider]VstsCredentialProvider - Attempting to exchange the bearer token for an Azure DevOps session token.
Resolved 10 packages in 25.31s # <-------------------- 25 sec vs 0.3 sec!
Prepared 10 packages in 3.70s
Installed 10 packages in 985ms
# (package versions printed here)

Verbose logs

I include full logs when appending --verbose to the calls for the pypi and other index-url case.

Platform

Windows 11 x86_64

Version

uv 0.5.25 (9c07c3fc5 2025-01-28)

Python version

3.12.8

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 2
  • Comments: 18 (7 by maintainers)

Most upvoted comments

The latest ADO update will be live in a few weeks. I will update here then. It’ll be much easier to debug using ADO feeds that don’t require authentication. From what I can tell, we definitely support range requests, but there might be some tweaking on either our or uv’s end to support faster package resolution.

We’re taking a look internally at fixing this. No promises at timelines. 😅 Thanks for your help!

I would be curious to hear why they don’t support HEAD requests — as that seems to be the crux of the problem here.

You could set RUST_LOG=trace to get verbose logs from the network layer and confirm the HTTP 405 is occurring.

But… if you make a HEAD request, the index returns a HTTP 405 method not allowed

❯ curl --head -L "https://pkgs.dev.azure.com/thomasaarholt/5e230929-47ac-48ad-97db-15ab1d2aa0c5/_packaging/56fc1e3a-f592-420b-bd14-a8c967a65c28/pypi/download/pandas/2.2.3/pandas-2.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
HTTP/2 405 

which is what we use to determine if range requests are supported

https://github.com/astral-sh/uv/blob/748582ee6f3ff1007692f131fa4b59d7c100ec66/crates/uv-client/src/registry_client.rs#L711-L753 https://github.com/prefix-dev/async_http_range_reader/blob/c2a1b5a63712a34bca661cc94389fb03fb0dcddd/src/lib.rs#L310-L318

So a range request does work with curl if you provide the -L flag to follow the redirects

❯ curl -H "Range: bytes=0-1048575" "https://pkgs.dev.azure.com/thomasaarholt/5e230929-47ac-48ad-97db-15ab1d2aa0c5/_packaging/56fc1e3a-f592-420b-bd14-a8c967a65c28/pypi/download/pandas/2.2.3/pandas-2.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=c124333816c3a9b03fbeef3a9f230ba9a737e9e5bb4060aa2107a86cc0a497fc" -f -L > chunk

Thank you so much for this quick response, this makes perfect sense. I’m contacting those responsible for adding support for this.

I’m closing this, but any pointers or advice for adding support for this sort of thing to a tracker is very much appreciated! I’m very pro not spending unnecessary energy boiling the oceans, especially in a CI!

When resolving, uv needs the metadata of every version used in the resolution. This information we get from a file called METADATA inside the <name>-<version>.dist-info directory of the wheel. PyPI exposes this file directly in the API (PEP 658). For most other server we can use HTTP Range requests to read only the METADATA file from the zip without downloading and unpacking the entire file. The index you’re using does neither support PEP 658 nor HTTP Range requests, so we have to download each wheel file to extract its metadata.

The hint is in this log message:

WARN Range requests not supported for numpy-2.2.2-cp311-cp311-win_amd64.whl; streaming wheel