Skip to content

Conversation

@nooscraft
Copy link
Contributor

Summary

Fixes --default not creating default executable links for pre-release Python versions.

When using --default with a pre-release version like 3.15.0a1, the code was checking matches_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 --default is used, which checks against the original user request.

Fixes #16696

Test Plan

Added python_install_default_prerelease test that installs Python 3.15 with --default and 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.

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.
@zanieb
Copy link
Member

zanieb commented Nov 12, 2025

Sorry another question here... isn't the entire first_request matching meaningless then? Can we just remove that.. ?

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.
@nooscraft
Copy link
Contributor Author

Sorry another question here... isn't the entire first_request matching meaningless then? Can we just remove that.. ?

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.
I've removed the first_request.matches_installation(installation) check and the unused first_request variable. The code now just checks default || (is_default_install && preview.is_enabled(...)).

Comment on lines 2269 to 2280
// 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
};
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, fixed this!

Comment on lines 2304 to 2305
// Clean up
let _ = context.python_uninstall().arg("--all").output();
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Comment on lines 2260 to 2262
// 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.
Copy link
Member

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

Copy link
Contributor Author

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.
@zanieb zanieb changed the title Fix --default flag for pre-release Python versions Fix handling of python install --default for pre-release Python versions Nov 12, 2025
@zanieb
Copy link
Member

zanieb commented Nov 12, 2025

Thanks!

@zanieb zanieb merged commit aec4254 into astral-sh:main Nov 12, 2025
99 checks passed
@zanieb zanieb added bug Something isn't working preview Experimental behavior labels Nov 12, 2025
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Nov 18, 2025
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` ([#&#8203;16473](astral-sh/uv#16473))
- Enforce UTF‑8-encoded license files during `uv build` ([#&#8203;16699](astral-sh/uv#16699))
- Error when a `project.license-files` glob matches nothing ([#&#8203;16697](astral-sh/uv#16697))
- `pip install --target` (and `sync`) install Python if necessary ([#&#8203;16694](astral-sh/uv#16694))
- Account for `python_downloads_json_url` in pre-release Python version warnings ([#&#8203;16737](astral-sh/uv#16737))
- Support HTTP/HTTPS URLs in `uv python --python-downloads-json-url` ([#&#8203;16542](astral-sh/uv#16542))

##### Preview features

- Add support for `--upgrade` in `uv python install` ([#&#8203;16676](astral-sh/uv#16676))
- Fix handling of `python install --default` for pre-release Python versions ([#&#8203;16706](astral-sh/uv#16706))
- Add `uv workspace list` to list workspace members ([#&#8203;16691](astral-sh/uv#16691))

##### Bug fixes

- Don't check file URLs for ambiguously parsed credentials ([#&#8203;16759](astral-sh/uv#16759))

##### Documentation

- Add a "storage" reference document ([#&#8203;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=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working preview Experimental behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uv python install <ver> --default works for 3.12 and 3.14 but not 3.15

2 participants