-
Notifications
You must be signed in to change notification settings - Fork 796
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
Add a uv-python
shim executable
#7677
Draft
zanieb
wants to merge
1
commit into
main
Choose a base branch
from
zb/python-shim
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
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
force-pushed
the
zb/python-shim
branch
from
September 24, 2024 22:34
e51729c
to
e0ecb54
Compare
zanieb
force-pushed
the
zb/python-shim
branch
from
September 24, 2024 23:31
e0ecb54
to
f541be2
Compare
zanieb
force-pushed
the
zb/python-shim
branch
from
September 25, 2024 02:14
f541be2
to
edcec81
Compare
zanieb
force-pushed
the
zb/python-shim
branch
from
September 25, 2024 15:33
edcec81
to
5b9b3ff
Compare
zanieb
force-pushed
the
zb/python-shim
branch
from
September 25, 2024 16:10
5b9b3ff
to
bf7c80d
Compare
zanieb
force-pushed
the
zb/python-shim
branch
from
September 25, 2024 16:47
bf7c80d
to
32d020c
Compare
zanieb
force-pushed
the
zb/python-shim
branch
from
September 25, 2024 17:09
32d020c
to
6c1ef6d
Compare
zanieb
force-pushed
the
zb/python-shim
branch
from
September 25, 2024 17:14
6c1ef6d
to
0201222
Compare
zanieb
force-pushed
the
zb/python-shim
branch
from
September 25, 2024 17:30
0201222
to
645bcc7
Compare
zanieb
force-pushed
the
zb/python-shim
branch
from
September 25, 2024 17:43
645bcc7
to
ed58ad0
Compare
zanieb
force-pushed
the
zb/python-shim
branch
from
September 26, 2024 20:26
ed58ad0
to
bd9fe3d
Compare
Cool! would it be possible to call the executable FYI you can do things like this on Windows:
It is something I miss when using mac |
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.
Adds a minimal
uv-python
binary to our distributions, which usesuv python find
to determine which Python executable to use then invokes it with all the arguments.Some notes:
uv-python
instead ofpython
so we don't replacepython
on thePATH
when uv is installed.python
duringuv python install
. We'll probably want more ways to manage the shim?Interpreter::query
calls to avoid recursive queries once a shim is installed--shim
/--no-shim
flags touv python install
. By default, we only install a shim if a CPython variant is installed and preview is enabled.Supports a few options, which can be used together:
uv-python +3.12 ...
.uv-python +managed ...
.uv-python +system ...
.uv-python +v ...
Unlike
uvx
, we usewhich
to find the uv binary instead of only looking next to the file. This is because we need this to be copyable into the user's path. Unfortunately this makes it hard for us to guarantee that we are finding the correct version of uv if multiple are installed, but that seems like an edge-case. We could add some sort ofUV_REQUIRED_VERSION
variable or something that tells the uv binary to bail if it's not the right version. We prefer a binary that we find next touv-python
which could help alleviate this — I'll need to look at what happens with symlinks and such.An alternative implementation is something like
uvx
where we add auv python run
command and then create aliases to it. That route is powerful because we can have advanced behaviors and rely on other crates without increasing the size of our installation. However, the constraints of this approach may be a good thing.Unfortunately we need to invoke uv to find the Python interpreter to use and uv queries Python interpreters so this probably adds some significant overhead to a
python
invocation. I'll benchmark this before moving out of draft.