Skip to content

Make it easier to deploy a mirror for uv-python command #10203

@MeitarR

Description

@MeitarR

The problem

Currently, in order to use the feature of uv to fetch Python versions (uv python install), in internal and air-gapped networks,
one needs to

  1. download all the needed binaries (using https://github.com/astral-sh/uv/blob/main/scripts/create-python-mirror.py )
  2. then get the resulting folder (14~ GB for a single uv version) to the target network - depending on the organization it may be a complicated stage, that is very hard (or even impossible) to automate
  3. and serve it to everyone else in the target network.

a process that may take hours.

The big issue is that the paths of the CPython binaries are hardcoded in the binary and change almost every release of uv. Thus, the one who maintains the mirror must go through that process frequently, or else the feature of uv python install will break when updating the uv version locally.

(see https://github.com/astral-sh/uv/commits/main/crates/uv-python/download-metadata.json for the frequency)

Suggested solution

instead of hardcoded URLs, fetch the json externally.

I think that one way of solving this issue is, instead of hardcoding the list of URLs in the binary, you can fetch the list (json) https://github.com/astral-sh/uv/blob/main/crates/uv-python/download-metadata.json from external URL (probably from the repo), letting you update the available python binaries versions without the need to update uv, and let the users change the URL the binary uses to fetch the JSON (https://github.com/astral-sh/uv/blob/main/crates/uv-python/download-metadata.json), so it will work for every version of uv, and if you update your list, we can download and update it in the target network later without consequences.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wishNot on the immediate roadmap

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions