Install versioned Python executables into the bin directory during uv python install#8458
Merged
Install versioned Python executables into the bin directory during uv python install#8458
uv python install#8458Conversation
uv python install
b3f1ede to
dc70ac5
Compare
dc70ac5 to
a5bae91
Compare
a5bae91 to
b188781
Compare
1396487 to
6bd04ee
Compare
6bd04ee to
3157909
Compare
3157909 to
cb814eb
Compare
zanieb
commented
Oct 22, 2024
Comment on lines
-339
to
-342
| // Workaround for python-build-standalone v20241016 which is missing the standard | ||
| // `python.exe` executable in free-threaded distributions on Windows. | ||
| // | ||
| // See https://github.com/astral-sh/uv/issues/8298 |
Member
Author
There was a problem hiding this comment.
This moved up, so executable always returns the existing executable for an installation and we ensure all the canonical names exist here.
zanieb
commented
Oct 22, 2024
Comment on lines
+412
to
+419
| let canonical_names = &["python"]; | ||
|
|
||
| for name in canonical_names { | ||
| let executable = |
Member
Author
There was a problem hiding this comment.
This refactored for future changes.
zanieb
added a commit
that referenced
this pull request
Oct 29, 2024
Currently, our trampoline is used to convert `<command> [args]` to `python <command> [args]` for script entrypoints installed into virtual environments. For #8458, it'd be nice to convert a shim `python3.12 [args]` to `python [args]`. Here, we modify the trampolines to support this use-case. The only change we really need here is to avoid injecting `<command>` into the child process. We change the "magic number" at the end of the trampoline executables from `UVUV` to `UVSC` and `UVPY` which define "script" and "python" variants to the trampoline. We then omit the `<command>` injection in the latter case. We also omit writing the zip script payload. To support construction of the new variant, a new `uv-trampoline-builder` crate is introduced — this avoids requirements on `uv-install-wheel` in future work. I also use `uv-trampoline-builder` to consolidate some of the test setup for `uv-trampoline`. There should be no backwards compatibility concerns, since trampolines are fully self-referential. I rebased to fix the commits at the end, as this took many iterations to get working via CI. This should roughly be reviewable by commit if you prefer.
zanieb
added a commit
that referenced
this pull request
Oct 29, 2024
Currently, our trampoline is used to convert `<command> [args]` to `python <command> [args]` for script entrypoints installed into virtual environments. For #8458, it'd be nice to convert a shim `python3.12 [args]` to `python [args]`. Here, we modify the trampolines to support this use-case. The only change we really need here is to avoid injecting `<command>` into the child process. We change the "magic number" at the end of the trampoline executables from `UVUV` to `UVSC` and `UVPY` which define "script" and "python" variants to the trampoline. We then omit the `<command>` injection in the latter case. We also omit writing the zip script payload. To support construction of the new variant, a new `uv-trampoline-builder` crate is introduced — this avoids requirements on `uv-install-wheel` in future work. I also use `uv-trampoline-builder` to consolidate some of the test setup for `uv-trampoline`. There should be no backwards compatibility concerns, since trampolines are fully self-referential. I rebased to fix the commits at the end, as this took many iterations to get working via CI. This should roughly be reviewable by commit if you prefer.
zanieb
added a commit
that referenced
this pull request
Oct 29, 2024
Following #8458, we need to remove the installed Python executables on `uv python uninstall`. Needs Windows support still, but that approach will be different since there won't be links.
zanieb
added a commit
that referenced
this pull request
Oct 29, 2024
Following #8458 we want to support showing the target directory in the CLI
zanieb
added a commit
that referenced
this pull request
Oct 29, 2024
Following #8458, we need to remove the installed Python executables on `uv python uninstall`. Needs Windows support still, but that approach will be different since there won't be links.
zanieb
added a commit
that referenced
this pull request
Oct 29, 2024
Following #8458 we want to support showing the target directory in the CLI
c76ec88 to
783e70d
Compare
zanieb
added a commit
that referenced
this pull request
Oct 29, 2024
Following #8458, we need to remove the installed Python executables on `uv python uninstall`. Needs Windows support still, but that approach will be different since there won't be links.
zanieb
added a commit
that referenced
this pull request
Oct 29, 2024
Following #8458 we want to support showing the target directory in the CLI
783e70d to
00873e2
Compare
charliermarsh
approved these changes
Oct 29, 2024
Member
charliermarsh
left a comment
There was a problem hiding this comment.
As per our conversation on Discord, I think it could make sense to gate this on preview.
…v python install`
…v python install`
Following #8458, we need to remove the installed Python executables on `uv python uninstall`. Needs Windows support still, but that approach will be different since there won't be links.
Member
Author
|
Going to gate with preview and rebase onto main. |
Following #8458 we want to support showing the target directory in the CLI
00873e2 to
7d2cf99
Compare
Member
Author
|
Note this also gated to Unix pending #8663 |
This file contains hidden or 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
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.
Updates
uv python installto linkpython3.xin the executable directory (i.e.,~/.local/bin) to the the managed interpreter path.Includes
uv python dir --bin#8569Remaining work
uv python install --default#8650