-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix handling of python install --default for pre-release Python versions
#16706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Use installation.satisfies() instead of matches_installation() when --default is used, allowing pre-release versions like 3.15.0a1 to be set as default when requested.
When --default is used, only one request is allowed, so we can skip the installation matching check since all installations in the loop already match the request.
|
Sorry another question here... isn't the entire |
When is_default_install is true, there's only one request and all installations in the loop already match that request, so the check is redundant.
Yes, When is_default_install is true, there's only one request and all installations in the loop already match it, so the check was redundant. |
crates/uv/tests/it/python_install.rs
Outdated
| // Try to install Python 3.15, which currently only exists as a pre-release (3.15.0a1). | ||
| // If 3.15 is not available, this test will be skipped naturally. | ||
| let Ok(output) = context | ||
| .python_install() | ||
| .arg("--default") | ||
| .arg("--preview-features") | ||
| .arg("python-install-default") | ||
| .arg("3.15") | ||
| .output() | ||
| else { | ||
| return; // Skip test if command fails | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should .assert().success() here instead. 3.15 is available, we shouldn't let the test silently fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, fixed this!
crates/uv/tests/it/python_install.rs
Outdated
| // Clean up | ||
| let _ = context.python_uninstall().arg("--all").output(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this, the tests run in isolated contexts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
crates/uv/tests/it/python_install.rs
Outdated
| // Test that --default works with pre-release versions (e.g., 3.15.0a1). | ||
| // This test verifies the fix for issue #16696 where --default didn't create | ||
| // python.exe and python3.exe links for pre-release versions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This belongs in a doc comment /// above the function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to doc comment
Use assert().success() to ensure the command succeeds instead of silently skipping. Remove cleanup since tests run in isolated contexts.
python install --default for pre-release Python versions
|
Thanks! |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.9.9` -> `0.9.10` | 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.10`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0910) [Compare Source](astral-sh/uv@0.9.9...0.9.10) Released on 2025-11-17. ##### Enhancements - Add support for `SSL_CERT_DIR` ([#​16473](astral-sh/uv#16473)) - Enforce UTF‑8-encoded license files during `uv build` ([#​16699](astral-sh/uv#16699)) - Error when a `project.license-files` glob matches nothing ([#​16697](astral-sh/uv#16697)) - `pip install --target` (and `sync`) install Python if necessary ([#​16694](astral-sh/uv#16694)) - Account for `python_downloads_json_url` in pre-release Python version warnings ([#​16737](astral-sh/uv#16737)) - Support HTTP/HTTPS URLs in `uv python --python-downloads-json-url` ([#​16542](astral-sh/uv#16542)) ##### Preview features - Add support for `--upgrade` in `uv python install` ([#​16676](astral-sh/uv#16676)) - Fix handling of `python install --default` for pre-release Python versions ([#​16706](astral-sh/uv#16706)) - Add `uv workspace list` to list workspace members ([#​16691](astral-sh/uv#16691)) ##### Bug fixes - Don't check file URLs for ambiguously parsed credentials ([#​16759](astral-sh/uv#16759)) ##### Documentation - Add a "storage" reference document ([#​15954](astral-sh/uv#15954)) </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=-->
Summary
Fixes
--defaultnot creating default executable links for pre-release Python versions.When using
--defaultwith a pre-release version like3.15.0a1, the code was checkingmatches_installation()against the download request instead of the original user request. This caused the check to fail since the download request doesn't match pre-release versions the same way.Changed it to use
installation.satisfies(&first_request.request)when--defaultis used, which checks against the original user request.Fixes #16696
Test Plan
Added
python_install_default_prereleasetest that installs Python 3.15 with--defaultand verifies all three executable links (python3.15,python3,python) are created. The test skips gracefully if 3.15 isn't available.All existing tests pass.