Skip to content

Prefer python over python3 in Unix environments - #21559

Merged
zanieb merged 4 commits into
mainfrom
zb/prefer-python-in-virtualenvs
Sep 11, 2026
Merged

zanieb merged 4 commits into
mainfrom
zb/prefer-python-in-virtualenvs

Conversation

@astral-automations-bot

Copy link
Copy Markdown
Contributor

Unix environment discovery prefers bin/python3 even when bin/python exists. This differs from the interpreter exposed by an activated environment and from pip's handling of directory-valued --python arguments.

Prefer bin/python, while retaining bin/python3 as a fallback for installations that omit the unversioned executable. This reverses the precedence introduced in #3798 without removing support for python3-only layouts. Explicit executable paths and version-specific PATH discovery are unchanged.

@astral-sh-bot

astral-sh-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown

uv test inventory changes

This PR changes the tests when compared with the main base revision.

  • Added tests: 1
  • Removed tests: 0
  • Changed suites: 1
uv::python: +1 / -0

Added:

  • uv::python::python_find::python_find_venv_executable_precedence

Removed: none

@zanieb zanieb removed the area:uv-python Related to the uv python interface label Sep 9, 2026
exit_code: 0 (success)
----- stderr -----
warning: Ignoring existing virtual environment linked to non-existent Python interpreter: .venv/[BIN]/[PYTHON] -> python
warning: Ignoring existing virtual environment linked to non-existent Python interpreter: .venv/[BIN]/[PYTHON] -> does-not-exist

@EliteTK EliteTK Sep 9, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Intriguing... The test looked more wrong before than it does now.

So if a symlink is pointing at a broken symlink we do not print the final broken target, but rather the intermediate (working) target?

Also weird that we don't print a full path?

I guess this avoids dealing with loops and such.

Oh well. Not important for this PR...

Comment thread crates/uv/tests/python/python_find.rs Outdated
[VENV]/bin/python
");

// Keep `python3` independent of the `python` symlink before removing the latter.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This comment explains (maybe not that clearly, but it could just be me) what the next two lines are trying to do. But then there are no more comments for the remaining snapshots. I feel they help a lot.

It could just be // Environments containing only python3 remain supported leading in for both with the blank line between them removed.

We actually don't test the case without .arg(context.venv.path()) for python above.

@zanieb
zanieb merged commit fb1439e into main Sep 11, 2026
181 checks passed
@zanieb
zanieb deleted the zb/prefer-python-in-virtualenvs branch September 11, 2026 12:51
luketainton pushed a commit to luketainton/repos_labmcp that referenced this pull request Sep 16, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ghcr.io/astral-sh/uv](https://github.com/astral-sh/uv) | final | patch | `0.12.12` → `0.12.15` |

---

> ⚠️ **Warning**
>
> Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/51) for more information.

---

### Release Notes

<details>
<summary>astral-sh/uv (ghcr.io/astral-sh/uv)</summary>

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

[Compare Source](astral-sh/uv@0.12.14...0.12.15)

Released on 2026-09-15.

This release fixes a regression in 0.12.14 that lead to rejecting valid installation commands such as using
`uv pip install --system` in `python:*` docker images or when using `uv pip install --target .`. ([#&#8203;21699](astral-sh/uv#21699))

##### Performance

- Speed up cold-cache resolution and HTTP cache revalidation by batching cache writes ([#&#8203;21675](astral-sh/uv#21675))

##### Bug fixes

- Revert "Reject symlinked wheel installation destinations" ([#&#8203;21699](astral-sh/uv#21699))

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

[Compare Source](astral-sh/uv@0.12.13...0.12.14)

Released on 2026-09-15.

Package-operation errors now use uv's standard diagnostics, with consistent hints and compact, labeled cause chains. ([#&#8203;17110](astral-sh/uv#17110), [#&#8203;21599](astral-sh/uv#21599), [#&#8203;21603](astral-sh/uv#21603))

Package-operation exit codes now reflect the underlying cause: expected failures return 1, while recognized operational and internal failures return 2. ([#&#8203;17110](astral-sh/uv#17110))

##### Enhancements

- Resume interrupted downloads with HTTP Range requests when supported ([#&#8203;21570](astral-sh/uv#21570))
- Show underlying causes and hints in user warnings ([#&#8203;21565](astral-sh/uv#21565))
- Show resolver hints for failed `uv tool upgrade` operations ([#&#8203;21566](astral-sh/uv#21566))

##### Preview features

- Export multiple dependency selections from a shared lockfile in one `uv export --batch` invocation with the `batch-export` preview feature ([#&#8203;21618](astral-sh/uv#21618))

##### Performance

- Speed up dependency resolution from local wheelhouses by reading wheel metadata in a single blocking task ([#&#8203;21619](astral-sh/uv#21619))
- Speed up cold resolution against large package indexes by parsing Simple API responses in bounded background workers ([#&#8203;21593](astral-sh/uv#21593))
- Speed up warm-cache resolution by decoding fresh HTTP cache entries in the cache-read task ([#&#8203;21621](astral-sh/uv#21621))

##### Bug fixes

- Select releases that satisfy `required-environments` within each resolver fork instead of combining incompatible wheel coverage across forks ([#&#8203;21672](astral-sh/uv#21672))
- Install packages with paths longer than `MAX_PATH` on Windows systems without long-path support enabled ([#&#8203;21625](astral-sh/uv#21625))
- Prevent `uv python install` from overwriting valid unmanaged Python symlinks with relative targets on Unix ([#&#8203;21639](astral-sh/uv#21639))
- Redact credentials and signatures from missing-path-segment URL errors ([#&#8203;21616](astral-sh/uv#21616))
- Avoid exceeding the configured retry budget when cached HTTP responses fail revalidation ([#&#8203;21640](astral-sh/uv#21640))
- Prefer `bin/python` over `bin/python3` when discovering interpreters in Unix environments ([#&#8203;21559](astral-sh/uv#21559))
- Suppress managed-Python fallback warnings under `--quiet` ([#&#8203;21565](astral-sh/uv#21565))
- Keep failed `uv tool upgrade` errors visible with `-q` while suppressing them with `-qq` ([#&#8203;21566](astral-sh/uv#21566))

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

[Compare Source](astral-sh/uv@0.12.12...0.12.13)

Released on 2026-09-10.

##### Python

- Add GraalPy 3.13.0 ([#&#8203;21431](astral-sh/uv#21431))

##### Enhancements

- Verify hashes when downloading PEP 658 metadata sidecars ([#&#8203;21563](astral-sh/uv#21563))

##### Preview features

- Respect `ty` exclusions when `uv check` automatically selects members of a virtual workspace ([#&#8203;21555](astral-sh/uv#21555))

##### Performance

- Avoid full wheel downloads during resolution by reusing supported hashes from direct URL fragments when metadata is available separately ([#&#8203;21279](astral-sh/uv#21279))

##### Bug fixes

- Edit Windows entry-point launcher resources in memory to support Nano Server and reduce antivirus contention ([#&#8203;18713](astral-sh/uv#18713))
- Prefer `core-metadata` over legacy aliases in JSON index responses ([#&#8203;21563](astral-sh/uv#21563))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

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

---

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

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC43Ny4wIiwidXBkYXRlZEluVmVyIjoiNDQuNzcuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsidHlwZS9kZXBlbmRlbmNpZXMiXX0=-->

Reviewed-on: https://git.tainton.uk/repos/labmcp/pulls/55
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
luketainton pushed a commit to luketainton/luke_rsu that referenced this pull request Sep 16, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ghcr.io/astral-sh/uv](https://github.com/astral-sh/uv) | stage | patch | `0.12.12` → `0.12.15` |

---

> ⚠️ **Warning**
>
> Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/11) for more information.

---

### Release Notes

<details>
<summary>astral-sh/uv (ghcr.io/astral-sh/uv)</summary>

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

[Compare Source](astral-sh/uv@0.12.14...0.12.15)

Released on 2026-09-15.

This release fixes a regression in 0.12.14 that lead to rejecting valid installation commands such as using
`uv pip install --system` in `python:*` docker images or when using `uv pip install --target .`. ([#&#8203;21699](astral-sh/uv#21699))

##### Performance

- Speed up cold-cache resolution and HTTP cache revalidation by batching cache writes ([#&#8203;21675](astral-sh/uv#21675))

##### Bug fixes

- Revert "Reject symlinked wheel installation destinations" ([#&#8203;21699](astral-sh/uv#21699))

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

[Compare Source](astral-sh/uv@0.12.13...0.12.14)

Released on 2026-09-15.

Package-operation errors now use uv's standard diagnostics, with consistent hints and compact, labeled cause chains. ([#&#8203;17110](astral-sh/uv#17110), [#&#8203;21599](astral-sh/uv#21599), [#&#8203;21603](astral-sh/uv#21603))

Package-operation exit codes now reflect the underlying cause: expected failures return 1, while recognized operational and internal failures return 2. ([#&#8203;17110](astral-sh/uv#17110))

##### Enhancements

- Resume interrupted downloads with HTTP Range requests when supported ([#&#8203;21570](astral-sh/uv#21570))
- Show underlying causes and hints in user warnings ([#&#8203;21565](astral-sh/uv#21565))
- Show resolver hints for failed `uv tool upgrade` operations ([#&#8203;21566](astral-sh/uv#21566))

##### Preview features

- Export multiple dependency selections from a shared lockfile in one `uv export --batch` invocation with the `batch-export` preview feature ([#&#8203;21618](astral-sh/uv#21618))

##### Performance

- Speed up dependency resolution from local wheelhouses by reading wheel metadata in a single blocking task ([#&#8203;21619](astral-sh/uv#21619))
- Speed up cold resolution against large package indexes by parsing Simple API responses in bounded background workers ([#&#8203;21593](astral-sh/uv#21593))
- Speed up warm-cache resolution by decoding fresh HTTP cache entries in the cache-read task ([#&#8203;21621](astral-sh/uv#21621))

##### Bug fixes

- Select releases that satisfy `required-environments` within each resolver fork instead of combining incompatible wheel coverage across forks ([#&#8203;21672](astral-sh/uv#21672))
- Install packages with paths longer than `MAX_PATH` on Windows systems without long-path support enabled ([#&#8203;21625](astral-sh/uv#21625))
- Prevent `uv python install` from overwriting valid unmanaged Python symlinks with relative targets on Unix ([#&#8203;21639](astral-sh/uv#21639))
- Redact credentials and signatures from missing-path-segment URL errors ([#&#8203;21616](astral-sh/uv#21616))
- Avoid exceeding the configured retry budget when cached HTTP responses fail revalidation ([#&#8203;21640](astral-sh/uv#21640))
- Prefer `bin/python` over `bin/python3` when discovering interpreters in Unix environments ([#&#8203;21559](astral-sh/uv#21559))
- Suppress managed-Python fallback warnings under `--quiet` ([#&#8203;21565](astral-sh/uv#21565))
- Keep failed `uv tool upgrade` errors visible with `-q` while suppressing them with `-qq` ([#&#8203;21566](astral-sh/uv#21566))

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

[Compare Source](astral-sh/uv@0.12.12...0.12.13)

Released on 2026-09-10.

##### Python

- Add GraalPy 3.13.0 ([#&#8203;21431](astral-sh/uv#21431))

##### Enhancements

- Verify hashes when downloading PEP 658 metadata sidecars ([#&#8203;21563](astral-sh/uv#21563))

##### Preview features

- Respect `ty` exclusions when `uv check` automatically selects members of a virtual workspace ([#&#8203;21555](astral-sh/uv#21555))

##### Performance

- Avoid full wheel downloads during resolution by reusing supported hashes from direct URL fragments when metadata is available separately ([#&#8203;21279](astral-sh/uv#21279))

##### Bug fixes

- Edit Windows entry-point launcher resources in memory to support Nano Server and reduce antivirus contention ([#&#8203;18713](astral-sh/uv#18713))
- Prefer `core-metadata` over legacy aliases in JSON index responses ([#&#8203;21563](astral-sh/uv#21563))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

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

---

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

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC43Ny4wIiwidXBkYXRlZEluVmVyIjoiNDQuNzcuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsidHlwZS9kZXBlbmRlbmNpZXMiXX0=-->

Reviewed-on: https://git.tainton.uk/repos/rsu/pulls/44
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
hbjydev pushed a commit to hbjydev/phoebe that referenced this pull request Sep 20, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [uv](https://github.com/astral-sh/uv) | tools | patch | `0.12.13` → `0.12.17` |

---

> ⚠️ **Warning**
>
> Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/141) for more information.

---

### Release Notes

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

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

[Compare Source](astral-sh/uv@0.12.16...0.12.17)

Released on 2026-09-18.

##### Enhancements

- Reject unsupported Git archive paths in lockfiles with a clear error instead of panicking during frozen exports ([#&#8203;21780](astral-sh/uv#21780))

##### Preview features

- Set minimum glibc and musl versions that universal resolutions must support with `minimum-libc-version` ([#&#8203;21651](astral-sh/uv#21651))
- Reject `pylock.toml` files whose wheel filenames do not match their declared package names or versions ([#&#8203;20746](astral-sh/uv#20746))
- Keep `uv workspace metadata` read-only unless `--sync` is provided ([#&#8203;21821](astral-sh/uv#21821))
- Apply `uv check` lock modes when retrieving workspace metadata ([#&#8203;21821](astral-sh/uv#21821))

##### Performance

- Speed up builds with many exclusion patterns by avoiding quadratic deduplication ([#&#8203;21650](astral-sh/uv#21650))
- Reduce resolver allocations when deduplicating package and distribution requests ([#&#8203;21810](astral-sh/uv#21810))

##### Bug fixes

- Prevent `required-environments` from selecting package versions whose wheels require a newer macOS version than the configured Darwin baseline ([#&#8203;21825](astral-sh/uv#21825))

##### Documentation

- Clarify the 0.12.14 and 0.12.15 release notes ([#&#8203;21817](astral-sh/uv#21817))

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

[Compare Source](astral-sh/uv@0.12.15...0.12.16)

Released on 2026-09-17.

##### Python

- Add Pyodide 314.0.7, 0.29.5, and 0.27.8 ([#&#8203;21741](astral-sh/uv#21741))

##### Enhancements

- Verify downloaded wheels and source distributions against hashes supplied by package indexes ([#&#8203;21562](astral-sh/uv#21562))
- Allow `build-constraint-dependencies` entries to include hashes for verifying downloaded build dependencies ([#&#8203;21467](astral-sh/uv#21467))
- Honor Darwin `platform_release` markers in `required-environments` using macOS wheel deployment targets ([#&#8203;21766](astral-sh/uv#21766))
- Reject unsupported Git URL schemes while parsing lockfiles instead of panicking during frozen exports ([#&#8203;21779](astral-sh/uv#21779))

##### Preview features

- Support `lock-without-metadata` across all dependency types while retaining `package.metadata` for remote URL dependencies to enable offline validation ([#&#8203;21163](astral-sh/uv#21163))
- Honor configured and command-line index settings, including credentials, in `uv upgrade` ([#&#8203;21776](astral-sh/uv#21776))
- Allow `uv check` to run in projects that are not managed by uv and outside workspaces ([#&#8203;21777](astral-sh/uv#21777))
- Respect `--python` and `UV_PYTHON` when selecting the Python version for `uv check` ([#&#8203;21744](astral-sh/uv#21744))

##### Bug fixes

- Redact Azure shared access signatures from displayed and logged URLs ([#&#8203;21755](astral-sh/uv#21755))
- Check archive sizes from `pylock.toml` before reusing cached distributions ([#&#8203;21609](astral-sh/uv#21609))
- Keep user-authored local dependency paths relative in lockfiles when backend metadata reports absolute paths ([#&#8203;20631](astral-sh/uv#20631))
- Use the bundled `uv_build` backend only when its version matches active version pins ([#&#8203;21742](astral-sh/uv#21742))
- Handle malformed index URLs without panicking when credentials are configured ([#&#8203;21784](astral-sh/uv#21784))
- Report a configuration error instead of panicking for proxy URLs without a host ([#&#8203;21781](astral-sh/uv#21781))
- Return a credential-redacted error instead of panicking when a URL cannot be converted to a path ([#&#8203;21783](astral-sh/uv#21783))

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

[Compare Source](astral-sh/uv@0.12.14...0.12.15)

Released on 2026-09-15.

This release fixes a regression in 0.12.14 that lead to rejecting valid installation commands such as using
`uv pip install --system` in `python:*` docker images or when using `uv pip install --target .`. ([#&#8203;21699](astral-sh/uv#21699))

##### Performance

- Speed up cold-cache resolution and HTTP cache revalidation by batching cache writes ([#&#8203;21675](astral-sh/uv#21675))

##### Bug fixes

- Revert "Reject symlinked wheel installation destinations" ([#&#8203;21699](astral-sh/uv#21699))

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

[Compare Source](astral-sh/uv@0.12.13...0.12.14)

Released on 2026-09-15.

Package-operation errors now use uv's standard diagnostics, with consistent hints and compact, labeled cause chains. ([#&#8203;17110](astral-sh/uv#17110), [#&#8203;21599](astral-sh/uv#21599), [#&#8203;21603](astral-sh/uv#21603))

Package-operation exit codes now reflect the underlying cause: expected failures return 1, while recognized operational and internal failures return 2. ([#&#8203;17110](astral-sh/uv#17110))

##### Enhancements

- Resume interrupted downloads with HTTP Range requests when supported ([#&#8203;21570](astral-sh/uv#21570))
- Show underlying causes and hints in user warnings ([#&#8203;21565](astral-sh/uv#21565))
- Show resolver hints for failed `uv tool upgrade` operations ([#&#8203;21566](astral-sh/uv#21566))

##### Preview features

- Export multiple dependency selections from a shared lockfile in one `uv export --batch` invocation with the `batch-export` preview feature ([#&#8203;21618](astral-sh/uv#21618))

##### Performance

- Speed up dependency resolution from local wheelhouses by reading wheel metadata in a single blocking task ([#&#8203;21619](astral-sh/uv#21619))
- Speed up cold resolution against large package indexes by parsing Simple API responses in bounded background workers ([#&#8203;21593](astral-sh/uv#21593))
- Speed up warm-cache resolution by decoding fresh HTTP cache entries in the cache-read task ([#&#8203;21621](astral-sh/uv#21621))

##### Bug fixes

- Select releases that satisfy `required-environments` within each resolver fork instead of combining incompatible wheel coverage across forks ([#&#8203;21672](astral-sh/uv#21672))
- Install packages with paths longer than `MAX_PATH` on Windows systems without long-path support enabled ([#&#8203;21625](astral-sh/uv#21625))
- Prevent `uv python install` from overwriting valid unmanaged Python symlinks with relative targets on Unix ([#&#8203;21639](astral-sh/uv#21639))
- Redact credentials and signatures from missing-path-segment URL errors ([#&#8203;21616](astral-sh/uv#21616))
- Avoid exceeding the configured retry budget when cached HTTP responses fail revalidation ([#&#8203;21640](astral-sh/uv#21640))
- Prefer `bin/python` over `bin/python3` when discovering interpreters in Unix environments ([#&#8203;21559](astral-sh/uv#21559))
- Suppress managed-Python fallback warnings under `--quiet` ([#&#8203;21565](astral-sh/uv#21565))
- Keep failed `uv tool upgrade` errors visible with `-q` while suppressing them with `-qq` ([#&#8203;21566](astral-sh/uv#21566))

</details>

---

### Configuration

📅 **Schedule**: (in timezone Europe/London)

- 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 PR becomes conflicted, or you tick the rebase/retry checkbox.

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

---

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

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC45MC4yIiwidXBkYXRlZEluVmVyIjoiNDQuMTA0LjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbInJlbm92YXRlL2dpdGh1Yi1yZWxlYXNlIiwidHlwZS9wYXRjaCJdfQ==-->

Reviewed-on: https://git.hayden.moe/hayden/phoebe/pulls/632
zanieb pushed a commit that referenced this pull request Oct 7, 2026
Virtual environment discovery now prefers bin/python on Unix (#21559), matching the executable recorded when the environment is created. Cache inferred metadata under that path so the next lookup finds it.

This branch was previously deployed

1 inactive deployment
automations — c1e590a8 Deployed Sep 10, 2026 by zanieb via review / security review #46320
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants