-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
fix: ensure 'uv' always works in a uv venv #818
Conversation
f288bc5
to
ccb0ec4
Compare
529d632
to
90c62b0
Compare
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
36daaed
to
7415271
Compare
Signed-off-by: Henry Schreiner <[email protected]>
Added handling for one more corner case: if a user installs uv into a uv environment, they'd probably expect the new uv to be used after they installed it, just like pip is for pip environments. This worked except for the "installed alongside nox" case. Now it matches the "on path" case. Tested locally with: @nox.session(venv_backend="uv")
def uv(session):
session.install("uv")
session.install("pip") $ pipx run --spec .[uv] nox -s uv
⚠️ nox is already on your PATH and installed at /usr/local/bin/nox. Downloading and running anyway.
nox > Running session uv
nox > Creating virtual environment (uv) using python in .nox/uv
nox > /Users/henryschreiner/.local/pipx/.cache/ee854022650cc85/bin/uv pip install uv
nox > uv pip install pip |
Can you add a source code comment to explain this edge case? It would also be good to have a comment for the |
Signed-off-by: Henry Schreiner <[email protected]>
c18f2ca
to
8765007
Compare
Added comments and added to tests. |
It's necessary sometimes to use the backend tool (pip, uv, conda, mamba, micromamba) inside a virtual environment. We already have a bit of special casing for it, making sure it's not considered "external". This PR just makes sure that
.run("uv", ...)
is always supported if you are using the uv backend. All the other backends are already gaurenteed to be on the path if they are active, so no change is needed (yet, anyway - this mechanism could also enable usingpip
from outside instead of always installing it, might be worth investigating in the future).Followup to and generalizes #795.