Skip to content

Add support for customizing Astral mirror URLs #18525

Description

@leodevian

Summary

Hello!

Following the introduction of an Astral mirror which is used to fetch Ruff release metadata, Ruff, CPython and uv itself, I was wondering whether it could be made possible to customize these URLs.

In isolated environments, access to github.com or releases.astral.sh might not permitted, and it is currently impossible to proxy requests to proxy repositories or internal mirrors. Thus, it is impossible to download Ruff using uv, uv cannot update itself, and the uv version must be provided explicitly when installing uv using its standalone installer.

I believe that adding support for customizing the base URL of the Astral mirror could solve these issues.

I know that the updater does not fetch uv release metadata and uv archives from an Astral mirror yet, but I believe that this is already on Astral's roadmap.

Design-wise, I believe that adding configuration support using a single environment variable would be enough.

Example

Considering that UV_ASTRAL_MIRROR_URL could be set to customize the base URL of the Astral mirror, it could be used as such:

$ curl https://github.com/
curl: (6) Could not resolve host: github.com
$ curl https://releases.astral.sh/
curl: (6) Could not resolve host: releases.astral.sh
$ export UV_ASTRAL_MIRROR_URL="https://nexus.example.com/repository/releases.astral.sh"
$ uv python install 3.14  # uv fetches CPython from the proxy repository.
$ uv format  # uv fetches Ruff release metadata and Ruff from the proxy repository.
$ uv self update # The updater fetches uv release metadata and uv from the proxy repository.

Activity

  1. added
    enhancementNew feature or improvement to existing functionality
    on Mar 17, 2026
  2. zsol commented on Mar 17, 2026

    @zsol
    Member

    Some extra context:

  3. self-assigned this
    on Mar 17, 2026
  4. leodevian commented on Mar 17, 2026

    @leodevian
    ContributorAuthor

    Some extra context:

    * Current status of what's fetched from the mirror and what isn't is tracked under [Fetch release assets from `releases.astral.sh` first #18503](https://github.com/astral-sh/uv/issues/18503)
    
    * You can customize [`UV_DOWNLOAD_URL`](https://docs.astral.sh/uv/reference/environment/#uv_download_url) when fetching uv using the standalone installer scripts, in which case the mirror won't be used
    
    * There's also [`UV_INSTALLER_GITHUB_BASE_URL`](https://docs.astral.sh/uv/reference/environment/#uv_installer_github_base_url) which apparently `uv self update` also respects
    
    * For Python downloads there's [this setting](https://docs.astral.sh/uv/reference/settings/#python-install-mirror) that already controls the mirror URL, but I don't think there's an environment variable
    
    * Fetching of Ruff isn't configurable at all at the moment
    

    Thank you for the quick answer!

    UV_DOWNLOAD_URL and UV_PYTHON_INSTALL_MIRROR can be used to make it possible to install uv and CPython, but it remains impossible to run updates. UV_INSTALLER_GITHUB_BASE_URL cannot be used in environments without access to GitHub or GitHub Enterprise as the updater uses the GitHub REST API to fetch release metadata.

    Because UV_DOWNLOAD_URL includes the version to install and because there is no solution to make uv self update work in isolated environments, uv needs to be reinstalled regularly to keep up-to-date.

    I believe that #9134 (Sonatype Nexus Repository) and #16519 (JFrog Artifactory) are related and would be solved with the resolution of the current issue.

  5. leodevian commented on Apr 24, 2026

    @leodevian
    ContributorAuthor

    Congrats on completing #18503! It makes it easier to install the latest versions of uv. Now that everything (?) has been migrated to releases.astral.sh, do you believe that such configuration could be implemented?

    An unmentioned issue with GitHub-related environment variables is that any path is stripped and only the domain name is kept. This makes sense but it makes it impossible to use with proxy repositories.

  6. zsol commented on Apr 28, 2026

    @zsol
    Member

    Yeah I think this is a reasonable feature to implement.

    That would effectively resolve these: #9134 #16519 #17255 #15970

  7. iodbh commented on May 18, 2026

    @iodbh

    Thank you for your work on this, the new env var is very useful !

    Would it be possible for the install script to support it as well ? It contains

    if [ -n "${UV_DOWNLOAD_URL:-}" ]; then
        ARTIFACT_DOWNLOAD_URLS="$UV_DOWNLOAD_URL"
    elif [ -n "${INSTALLER_DOWNLOAD_URL:-}" ]; then
        ARTIFACT_DOWNLOAD_URLS="$INSTALLER_DOWNLOAD_URL"
    elif [ -n "${UV_INSTALLER_GHE_BASE_URL:-}" ]; then
        INSTALLER_BASE_URL="$UV_INSTALLER_GHE_BASE_URL"
        ARTIFACT_DOWNLOAD_URLS="${INSTALLER_BASE_URL}/astral-sh/uv/releases/download/0.11.14"
    elif [ -n "${UV_INSTALLER_GITHUB_BASE_URL:-}" ]; then
        INSTALLER_BASE_URL="$UV_INSTALLER_GITHUB_BASE_URL"
        ARTIFACT_DOWNLOAD_URLS="${INSTALLER_BASE_URL}/astral-sh/uv/releases/download/0.11.14"
    else
        ARTIFACT_DOWNLOAD_URLS="https://releases.astral.sh/github/uv/releases/download/0.11.14 https://github.com/astral-sh/uv/releases/download/0.11.14"
    fi

    So there is no path to installing the latest version from a mirror

    something in that vein:

    ARTIFACT_DOWNLOAD_URLS="${UV_ASTRAL_MIRROR_URL:-https://releases.astral.sh}/github/uv/releases/download/0.11.14 https://github.com/astral-sh/uv/releases/download/0.11.14"
    

    would allow that

  8. zsol commented on May 18, 2026

    @zsol
    Member

    I don't fully understand why the existing env vars aren't enough for the standalone installer. Keep in mind that an installer is always tied to a particular version (the hashes of that version's binaries are embedded within the script).

  9. iodbh commented on May 19, 2026

    @iodbh

    Right, let me start by clarifying this is purely for convenience

    I'm trying to give our users installation instructions similar to curl -LsSf https://astral.sh/uv/install.sh | sh, in an environment where astral.sh can't be reached directly. The goal is "install the latest version without knowing what the latest version number is".

    The latest installer is available at https://releases.astral.sh/installers/uv/latest/uv-installer.sh, which is mirrored at https://our-mirror.our-company.com/installers/uv/latest/uv-installer.sh

    But there is currently no variable we can set to make the installer pull the uv binaries for the latest version from our mirror - we need to either:

    • specify ARTIFACT_DOWNLOAD_URLS with the full URL, including the version (so this is no longer "whatever the latest version is"
    • use sed or similar to replace https://releases.astral.sh with https://our-mirror.our-company.com, which seems a bit brittle

    So reading ARTIFACT_DOWNLOAD_URLS would allow us to go from:

    curl -LsSf https://our-mirror.our-company.com/installers/uv/latest/uv-installer.sh | sed 's#https://releases.astral.sh#hhttps://our-mirror.our-company.com/astral#g' | sh

    to

    curl -LsSf https://our-mirror.our-company.com/installers/uv/latest/uv-installer.sh  | sh

    This is a bit of an edge case, but might be worth considering for consistency with UV_INSTALLER_GITHUB_BASE_URL / UV_INSTALLER_GHE_BASE_URL (both allow setting a base URL without specifying the version, but rely on the github releases API)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:configurationSettings and sucharea:networkNetwork connectivity e.g. proxies, DNS, and SSLenhancementNew feature or improvement to existing functionality

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions