Repository navigation
Support proxy indexes through reversible artifact URLs - #20790
Conversation
67094f0 to
3092781
Compare
4ac91da to
34fb4ea
Compare
uv test inventory changesThis PR changes the tests when compared with the
|
34fb4ea to
bd9154e
Compare
bd9154e to
4e5bb80
Compare
4e5bb80 to
51c9cd8
Compare
51c9cd8 to
4ea9268
Compare
4ea9268 to
e4cafb3
Compare
e4cafb3 to
62318dd
Compare
62318dd to
1041074
Compare
|
We tested this branch (current revision, 1. Silent lockfile corruption when the proxy doesn't preserve artifact pathsGAR restructures file paths ( [[tool.uv.index]]
name = "gar-proxy"
url = "https://us-python.pkg.dev/<project>/<repo>/simple/"
artifact-base-url = "https://us-python.pkg.dev/<project>/<repo>/"
proxy-for = "pypi"
Installing through the proxy works (the reverse mapping round-trips), which means tests that only exercise the proxy path won't catch this. Installing the same lock without the proxy — the portability that canonical URLs exist to provide — fails with 404s on the fabricated URLs. The docs note that path-changing proxies are unsupported, but nothing detects the condition at runtime. Suggestion: hard-error at lock time when a canonical URL can't be derived verifiably, rather than persisting a guess. 2. Path preservation excludes the registries this feature seems aimed atOf the registries we operate against, no two share a path scheme:
So GAR (and, we suspect, similarly-shaped registries like AWS CodeArtifact) can't participate as either side of a proxy pair under the current design. A possible fallback when paths don't align: at install-from-lock time, resolve filename→URL via the proxy's simple index page per locked package — lockfile hashes already guarantee integrity regardless of which URL served the bytes. On cost: we measured this exact access pattern against GAR (worst-case index chatter — it serves neither PEP 658 nor PEP 691): ~5s of index fetches for a 235-package lock at modest parallelism, dwarfed by 4.7GB of wheel downloads. Happy to test iterations of this branch — we have a production-scale bed for it: two live registries with byte-identical mirrored artifacts and a 799-entry dual-arch lockfile. AI caveat: an agent wrote this but I reviewed it |
1041074 to
75990b3
Compare
|
@seemethere thanks for the feedback! We'll solve 2 in a followup PR. As for 1, that's an intentional design choice here. |
Recreate the environment without refreshing the cache when the proxy or artifact hash changes. Snapshot the full lockfile to cover upstream URLs, hashes, and upload times.
Write each scenario’s index and dependency metadata settings in the test. Check that a separate artifact host receives no proxy index credentials when it returns a 401.
Summary
Proxy indexes are a preview feature that lets uv resolve and download packages through a proxy while recording the upstream index and artifact URLs in the lockfile. This is useful, for example, when local development uses a proxy that filters out newly published packages but CI uses the upstream index directly. Both can use the same lockfile.
Proxy indexes are configured with
[[tool.uv.proxy-index]]inpyproject.tomlor[[proxy-index]]inuv.toml. Theproxy-forfield names an explicitly configured upstream index.For example, to proxy PyPI in
pyproject.toml:The path after each artifact base URL must match on both servers. uv swaps the prefixes without checking that the resulting upstream URL exists, so a proxy that changes the rest of the path can produce a lockfile that works only through the proxy.
uv sync --frozenrewrites artifact URLs fromuv.lockwithout querying the proxy's index. Installs frompylock.tomluse the proxy only whenpackages.indexidentifies the upstream index; otherwise, uv uses the recorded artifact URL.Implementation overview
artifact-base-url.