Skip to content

Fetch uv from Astral mirror during self-update#18682

Merged
zsol merged 2 commits intomainfrom
zsol/jj-llkyowxrwzll
Apr 17, 2026
Merged

Fetch uv from Astral mirror during self-update#18682
zsol merged 2 commits intomainfrom
zsol/jj-llkyowxrwzll

Conversation

@zsol
Copy link
Copy Markdown
Member

@zsol zsol commented Mar 23, 2026

Following #18679, at a high level this PR makes uv fetch the installer script from the Astral mirror (similarly to how we fetch the ndjson for version metadata), and then run the script directly, emulating what axoupdater would do.

Unfortunately after downloading the installer, we have to:

  • determine if the installer needs to be called with modify_path to update the user's PATH env var; axoupdater previously preserved the modify_path behavior across version upgrades, and so we do the same - based on the install receipt (which contains the value for this flag).
    • to do this we need to locate the receipt (because axo doesn't expose this flag in their APIs), the location of which can be customized using AXO-specific environment variables, which are new env vars we read now
  • rename the binary for the running uv process on Windows; axoupdater did this for us previously - otherwise we can't replace the binary on disk
    • restore the renamed binary in case of an update failure

This completes the uv self update (uv itself) item in #18503, and also removes a large part (but not all!) of the axoupdater code from the uv self update codepath.

Test Plan

Added tests, plus did this manually:

❯ cargo build --features self-update
[...]
❯ cp target/debug/uv ~/.local/bin/
❯ uv self update 0.11.0 -vv
DEBUG uv 0.11.1 (aarch64-apple-darwin)
DEBUG Using request connect timeout of 10s and read timeout of 30s
info: Checking for updates...
DEBUG Using official public self-update path
DEBUG Using request connect timeout of 10s and read timeout of 30s
TRACE Handling request for https://releases.astral.sh/github/versions/main/v1/uv.ndjson with authentication policy auto
TRACE Request for https://releases.astral.sh/github/versions/main/v1/uv.ndjson is unauthenticated, checking cache
TRACE No credentials in cache for URL https://releases.astral.sh/github/versions/main/v1/uv.ndjson
TRACE Attempting unauthenticated request for https://releases.astral.sh/github/versions/main/v1/uv.ndjson
DEBUG Resolved self-update target to `uv==0.11.0`
DEBUG Using request connect timeout of 10s and read timeout of 30s
TRACE Handling request for https://releases.astral.sh/github/uv/releases/download/0.11.0/uv-installer.sh with authentication policy auto
TRACE Request for https://releases.astral.sh/github/uv/releases/download/0.11.0/uv-installer.sh is unauthenticated, checking cache
TRACE No credentials in cache for URL https://releases.astral.sh/github/uv/releases/download/0.11.0/uv-installer.sh
TRACE Attempting unauthenticated request for https://releases.astral.sh/github/uv/releases/download/0.11.0/uv-installer.sh
success: Downgraded uv from v0.11.1 to v0.11.0! https://github.com/astral-sh/uv/releases/tag/0.11.0

@zsol zsol force-pushed the zsol/jj-qrmtulwxsrtv branch from 9d38982 to 96394b6 Compare March 23, 2026 19:32
@zsol zsol force-pushed the zsol/jj-llkyowxrwzll branch from 3b4f6a0 to 239998b Compare March 23, 2026 19:32
@zsol zsol force-pushed the zsol/jj-qrmtulwxsrtv branch from 96394b6 to d8f7c8b Compare March 23, 2026 19:43
@zsol zsol force-pushed the zsol/jj-llkyowxrwzll branch from 239998b to 8acffff Compare March 23, 2026 19:43
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Mar 23, 2026

Merging this PR will not alter performance

✅ 5 untouched benchmarks


Comparing zsol/jj-llkyowxrwzll (f3d3990) with main (91a51cb)

Open in CodSpeed

@zsol zsol force-pushed the zsol/jj-llkyowxrwzll branch from 8acffff to 4ada275 Compare March 24, 2026 11:39
@zsol zsol force-pushed the zsol/jj-qrmtulwxsrtv branch from d8f7c8b to 2a89699 Compare March 24, 2026 11:39
@zsol zsol changed the title Mirror official uv self-update installer downloads Fetch uv from Astral mirror during self-update Mar 24, 2026
Comment thread crates/uv/src/commands/self_update.rs Outdated
Comment thread crates/uv/src/commands/self_update.rs Outdated
Comment thread crates/uv/src/commands/self_update.rs Outdated
Comment thread crates/uv/src/commands/self_update.rs Outdated
Comment thread crates/uv/src/commands/self_update.rs Outdated
Comment thread crates/uv/src/commands/self_update.rs
Comment thread crates/uv/src/commands/self_update.rs
Comment thread crates/uv/src/commands/self_update.rs
Comment thread crates/uv/src/commands/self_update.rs
@zsol zsol force-pushed the zsol/jj-llkyowxrwzll branch 3 times, most recently from 3b21eae to fe00f2c Compare March 26, 2026 11:39
@zsol zsol requested a review from Gankra March 26, 2026 11:39
@zsol zsol marked this pull request as ready for review March 26, 2026 11:40
Base automatically changed from zsol/jj-qrmtulwxsrtv to main March 26, 2026 11:42
@zsol zsol force-pushed the zsol/jj-llkyowxrwzll branch 3 times, most recently from 7605d0f to bc4f5ce Compare March 26, 2026 15:53
@konstin konstin added the enhancement New feature or improvement to existing functionality label Mar 31, 2026
@zsol zsol force-pushed the zsol/jj-llkyowxrwzll branch from bc4f5ce to 60a58f9 Compare April 13, 2026 13:07
@zsol zsol force-pushed the zsol/jj-llkyowxrwzll branch from 60a58f9 to 9f5ccbc Compare April 14, 2026 10:26
Copy link
Copy Markdown
Contributor

@Gankra Gankra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite spooky but you did a good job with the tests

Comment thread crates/uv/src/commands/self_update.rs
Comment thread crates/uv/src/commands/self_update.rs
Comment thread crates/uv/src/commands/self_update.rs
Comment thread crates/uv/src/commands/self_update.rs Outdated
@zsol zsol merged commit 07f6155 into main Apr 17, 2026
111 checks passed
@zsol zsol deleted the zsol/jj-llkyowxrwzll branch April 17, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants