-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
UV_SYSTEM_PYTHON cannot be switched off #3000
Comments
Will need to look into it... This is something that Clap does automatically (https://github.com/clap-rs/clap), we just specify the mapping between argument and environment variable. |
Yeah I've noticed when looking at #2354. Since this problem will likely manifest itself elsewhere too, I hope this doesn't mean you have a clap rewrite on your plate, too. 😬 |
Hahah don't worry I have enough on my plate to be comfortable passing on that one :) |
I suspect the problem here is actually that Clap thinks both |
If you omit |
It does, but it has bad interactions with venv too (which is what sent me down this path):
|
Okay, I believe I know how to fix this. |
## Summary It turns out that if you have an environment variable set, Clap will consider that equivalent to passing the flag, even if it's set to (e.g.) something falsy or the default value. So, e.g., this fails: ```shell UV_SYSTEM=false uv pip install --python ./.venv/bin/python flask ``` Worse, this fails, because it thinks `--no-index` and `--index-url` are conflicting: ```shell export UV_INDEX_URL=https://google.com uv pip install flask --no-index ``` This PR removes some of the conflicts, namely those related to environment variables, such that: - You _can_ pass mixes of `--no-index`, `--index-url`, etc. If `--no-index` is provided, all the index URLs will be ignored (but we won't error). - Passing `--pre` will always enable prereleases, even if `--prerelease` is also provided. (We could warn here, although honestly it's not trivial because we'd need to make `--prerelease` take an optional, then we'd lose the default argument from the `--help`.) - You _can_ pass `--system` and `--python`. If `--python` is provided, we use that, and ignore `--system`. (We could warn here.) I guess the underlying problem here is that we can't differentiate between arguments passed on the CLI and those set as environment variables. But making bigger changes here seems out-of-scope. Closes #3000.
## Summary Allows, e.g., `UV_SYSTEM_PYTHON=false uv pip install --python .venv/bin/python`. This was intended to work after fixing #3000, but I think I misdiagnosed the scope when closing that issue, and the linked PR there only fixed some _other_ problems around index URLs. The only thing we really lose here is we no longer error when `--break-system-packages` is provided without `--system`, but we can enforce that elsewhere if we want. Closes #3829.
I'm using uv as part of a GitHub Action and have noticed that when the caller sets
UV_SYSTEM_PYTHON=true
, it cannot be undone by locally settingUV_SYSTEM_PYTHON=false
although the error indicates that false is a valid value. I always get the "system is incompatible with python":I have now solved it by unsetting the variable, but I think this should work?
The text was updated successfully, but these errors were encountered: