-
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
Clarify section on installing into arbitrary Python environments #4034
Clarify section on installing into arbitrary Python environments #4034
Conversation
install into the environment linked to the `/path/to/python` interpreter. | ||
|
||
For convenience, `uv pip install --system` will install into the system Python environment, as an | ||
approximate shorthand for, e.g., `uv pip install --python=$(which python3)`. Though we generally |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved --python=$(which python3)
to previous paragraph, since no longer equivalent to --system
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only saying it's an "approximate" shorthand. I think it's rare that your python
is a shim which automatically activates environments on invocation? Just responding to your comment though I might be okay with where it is now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only saying it's an "approximate" shorthand.
Sure, I get that. I guess what was confusing for me was than in uv<0.2, --system
seemed more or less equivalent to --python=$(which python3)
, whereas in uv>=0.2, this was no longer the case, at least for my use-case. Moreover, it's not currently clear in the text on main
under which conditions the equivalence holds.
I think it's rare that your
python
is a shim which automatically activates environments on invocation?
Hmm, as a pyenv-virtualenv user, this is always the case for me, but I'm not sure how prevalent this is, writ large.
I guess the main suggestion here is to provide clarity as to what --system
does: perhaps including how it may be similar to --python=$(which python3)
and how it differs.
README.md
Outdated
current interpreter on the `PATH`. Another way to install into the environment linked to the | ||
current interpeter is to invoke `uv` as a module (e.g., `python -m uv pip install`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added python -m uv
suggestion gleaned from https://github.com/astral-sh/uv/releases/tag/0.2.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hesitant to suggest this since it's slower than using uv
directly (you need to pay the cost of Python interpreter startup). Might be worth saying something about which interpreter is used in this case regardless though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, gotcha. Sorry, I didn't appreciate that. Thanks for the heads-up. I'll amend...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry. I didn't see your force-push. Will amend again...
README.md
Outdated
Unless the `--python` argument is provided, or uv is invoked as a module, | ||
uv will ignore any interpreters not in | ||
[PEP 405 compliant](https://peps.python.org/pep-0405/#specification) virtual environments, | ||
whether or not the `--system` flag is provided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure how to interpret this:
When the
--system
flag is provided, uv will ignore any interpreters that are not in PEP 405 compliant virtual environments. Similarly, if the--system
flag is not provided, uv will ignore any interpreters that are in not virtual environments.
This paragraph is a guess, but it may not be correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I find your paragraph confusing, but I inverted the clauses in mine (it's incorrect).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, since I didn't understand your version, I figured it must have included a misstatement :)
My text was an attempt to rephrase yours under the assumption it was correct as written, which means mine is also wrong. I'll revert and let you patch your version.
Thanks for doing this! I'll give it a closer read through later today |
Sorry, wrong button :) |
1c8c26b
to
5e72133
Compare
Summary
This meta-PR includes some suggestions for the docs on installing into arbitrary Python environments.
It targets the branch in #4031 and is a response to #3951 (comment).
Specifically, it:
--python=$(which python)
out of the--system
paragraph, as the two are no longer equivalentPATH
is associated with a virtual environment #4009 is implemented :)