-
Notifications
You must be signed in to change notification settings - Fork 914
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
base: main
Are you sure you want to change the base?
Conversation
e51729c
to
e0ecb54
Compare
e0ecb54
to
f541be2
Compare
f541be2
to
edcec81
Compare
edcec81
to
5b9b3ff
Compare
5b9b3ff
to
bf7c80d
Compare
bf7c80d
to
32d020c
Compare
32d020c
to
6c1ef6d
Compare
6c1ef6d
to
0201222
Compare
0201222
to
645bcc7
Compare
645bcc7
to
ed58ad0
Compare
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 |
Would be nice to run sync or at least have the option to run sync(with uv specific key in pyproject.toml). Could help teams maintain a consistent environment (especially if some users don't know as much about package management). |
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.