-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Set base executable when returning virtual environment #11209
Merged
Merged
+5
−0
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zanieb
approved these changes
Feb 4, 2025
b4fcd70
to
89c7d7b
Compare
charliermarsh
added a commit
that referenced
this pull request
Feb 5, 2025
## Summary This is attempting to solve the same problem surfaced in #11208 and #11209. However, those PRs only worked for our own managed Pythons. In Gentoo, for example, they disable the managed Pythons, which led to failures in the test suite, because the "base Python" returned after creating a virtual environment would differ from the "base Python" that you get after _querying_ an existing virtual environment. The fix here is to apply our same base Python normalization and discovery logic, to non-standalone / non-managed Pythons. We continue to use `sys._base_executable` for such Pythons when creating the virtualenv, but when _caching_, we perform this second discovery step. Closes #11237.
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Feb 6, 2025
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.5.27` -> `0.5.29` | 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.5.29`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0529) [Compare Source](astral-sh/uv@0.5.28...0.5.29) ##### Enhancements - Add `--bare` option to `uv init` ([#​11192](astral-sh/uv#11192)) - Add support for respecting `VIRTUAL_ENV` in project commands via `--active` ([#​11189](astral-sh/uv#11189)) - Allow the project `VIRTUAL_ENV` warning to be silenced with `--no-active` ([#​11251](astral-sh/uv#11251)) ##### Python The managed Python distributions have been updated, including: - CPython 3.12.9 - CPython 3.13.2 - pkg-config files are now relocatable See the [`python-build-standalone` release notes](https://github.com/astral-sh/python-build-standalone/releases/tag/20250205) for more details. ##### Bug fixes - Always use base Python discovery logic for cached environments ([#​11254](astral-sh/uv#11254)) - Use a flock to avoid concurrent initialization of project environments ([#​11259](astral-sh/uv#11259)) - Fix handling of `--all-groups` and `--no-default-groups` flags ([#​11224](astral-sh/uv#11224)) ##### Documentation - Minor touchups to the Docker provenance docs ([#​11252](astral-sh/uv#11252)) - Move content from the `mkdocs.public.yml` into the template ([#​11246](astral-sh/uv#11246)) ### [`v0.5.28`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0528) [Compare Source](astral-sh/uv@0.5.27...0.5.28) ##### Bug fixes - Allow discovering virtual environments from the first interpreter found on the `PATH` ([#​11218](astral-sh/uv#11218)) - Clear ephemeral overlays when running tools ([#​11141](astral-sh/uv#11141)) - Disable SSL in Git commands for `--allow-insecure-host` ([#​11210](astral-sh/uv#11210)) - Fix hardlinks in tar unpacking ([#​11221](astral-sh/uv#11221)) - Set base executable when returning virtual environment ([#​11209](astral-sh/uv#11209)) - Use base Python for cached environments ([#​11208](astral-sh/uv#11208)) ##### Documentation - Add documentation on verifying Docker image attestations ([#​11140](astral-sh/uv#11140)) - Add `last updated` to documentation ([#​11164](astral-sh/uv#11164)) </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:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNTguMSIsInVwZGF0ZWRJblZlciI6IjM5LjE1OC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
I'm not sure that this has much of an effect in practice, but currently, when we return a virtual environment, the
sys_base_executable
of the parent ends up being retained assys_base_executable
of the created environment. But these can be, like, subtly different? If you have a symlink to a Python, then for the symlink,sys_base_executable
will be equal tosys_executable
. But when you create a virtual environment for that interpreter, we'll sethome
to the resolved symlink, and sosys_base_executable
will be the resolved symlink too, in general. Anyway, this means that we should now have a consistent value between (1) returningVirtualenv
from the creation routine and (2) querying the created interpreter.