Skip to content

Conversation

@terror
Copy link
Contributor

@terror terror commented Nov 6, 2025

Resolves #16616

This PR detects managed prerelease interpreters during discovery and warns when a matching stable build is available, wiring the new helper into PythonInstallation::find, find_best, and find_or_download.

@terror terror marked this pull request as ready for review November 6, 2025 19:19
@terror terror changed the title Add managed-prerelease upgrade hint to uv run Warn on managed prerelease interpreters when a stable build is available Nov 6, 2025
@konstin konstin added the enhancement New feature or improvement to existing functionality label Nov 10, 2025
Comment on lines 464 to 465
(!matches!(version, VersionRequest::Any | VersionRequest::Default))
.then_some(version.to_string())
Copy link
Member

Choose a reason for hiding this comment

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

any vs default have different semantics, should we omit it in those cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, we are omitting them here right (i.e. !matches)? My understanding is we'd like to surface only the segments a user explicitly set, and these both represent (afaik) no explicit version constraint.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I meant "should we be omitting it"

That's fair. I think I'd expect those to be filtered in the unset_defaults method instead though?

It's a possible foot gun, in the sense that they have different semantics so omitting them could have a different result, but I can't really think of a concrete situation where this would occur. Emitting any would probably mess up the key parser anyway? :/ I'm fine omitting them until there's a problem.

Copy link
Contributor Author

@terror terror Nov 11, 2025

Choose a reason for hiding this comment

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

That's fair. I think I'd expect those to be filtered in the unset_defaults method instead though?

Yeah agreed, I think simplified_display should be simple in that it just filters out None values.

It's a possible foot gun, in the sense that they have different semantics so omitting them could have a different result, but I can't really think of a concrete situation where this would occur. Emitting any would probably mess up the key parser anyway? :/ I'm fine omitting them until there's a problem.

Looks like omitting anything will screw up the key parser (it expects 5 components), but since what we pass into uv python upgrade doesn't go through the key parsing flow, I think it's fine? 🤔 Especially sine omitting any/default here doesn't have any semantic loss, but I understand how if we use this for some other purpose there could be issues.

Copy link
Member

Choose a reason for hiding this comment

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

Just as a note

Looks like omitting anything will screw up the key parser (it expects 5 components),

I was referring to PythonDownloadRequest, which is how a request for a "key" is formed and does support missing components since #14399

since what we pass into uv python upgrade doesn't go through the key parsing flow

It could, e.g., we use the generic parser

.map(|target| PythonRequest::parse(target.as_str()))

if let Ok(request) = PythonDownloadRequest::from_str(value) {
return Self::Key(request);
}

so if you request uv python upgrade 3.14-x86_64 or something that goes through the key parsing flow

@zanieb zanieb merged commit 1b38b47 into astral-sh:main Nov 12, 2025
100 checks passed
)??)
let installation =
find_best_python_installation(request, environments, preference, cache, preview)??;
installation.warn_if_outdated_prerelease(request, None);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @terror and @zanieb, it's problematic to not always pass the python_downloads_json_url as it may warn users about versions that are not really available to them, as it does not look at the actual json that they use (if it's configured)

I think it should be passed, or not try to warn at all if python_downloads_json_url is configured

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, I missed that

Copy link
Member

Choose a reason for hiding this comment

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

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Nov 14, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.9.8` -> `0.9.9` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>astral-sh/uv (astral-sh/uv)</summary>

### [`v0.9.9`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#099)

[Compare Source](astral-sh/uv@0.9.8...0.9.9)

Released on 2025-11-12.

##### Deprecations

- Deprecate use of `--project` in `uv init` ([#&#8203;16674](astral-sh/uv#16674))

##### Enhancements

- Add iOS support to Python interpreter discovery ([#&#8203;16686](astral-sh/uv#16686))
- Reject ambiguously parsed URLs ([#&#8203;16622](astral-sh/uv#16622))
- Allow explicit values in `uv version --bump` ([#&#8203;16555](astral-sh/uv#16555))
- Warn on use of managed pre-release Python versions when a stable version is available ([#&#8203;16619](astral-sh/uv#16619))
- Allow signing trampolines on Windows by using `.rcdata` to store metadata ([#&#8203;15068](astral-sh/uv#15068))
- Add `--only-emit-workspace` and similar variants to `uv export` ([#&#8203;16681](astral-sh/uv#16681))

##### Preview features

- Add `uv workspace dir` command ([#&#8203;16678](astral-sh/uv#16678))
- Add `uv workspace metadata` command ([#&#8203;16516](astral-sh/uv#16516))

##### Configuration

- Add `UV_NO_DEFAULT_GROUPS` environment variable ([#&#8203;16645](astral-sh/uv#16645))

##### Bug fixes

- Remove `torch-model-archiver` and `torch-tb-profiler` from PyTorch backend ([#&#8203;16655](astral-sh/uv#16655))
- Fix Pixi environment detection ([#&#8203;16585](astral-sh/uv#16585))

##### Documentation

- Fix `CMD` path in FastAPI Dockerfile ([#&#8203;16701](astral-sh/uv#16701))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNzMuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE3My4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
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.

Add a hint when a stable version of Python is available

4 participants