-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Command line for notice update not copy-pasteable for venv #13156
Comments
The command isn't intended to be copy-pastable. There are too many edge cases (such as spaces or special characters in path names) which would require shell-specific quoting, and rather than have something that looks copy-pastable, but often isn't, we prefer to explain to the user what they need to do in more general terms. |
The problem is that the current message looks copy-pasteable and in the vast majority of cases when copy-pasted it'll run and perform an update, just not updating the right thing. I filed this after having had to help out explaining why the same message kept reappearing despite running the command. |
If you have any suggestions for better wording, that would be fine. But something that can be copy-pasted is explicitly not a goal here. Consider if you had a virtual environment |
I actually believe that such a command line, which resulted in an error message when copy-pasted if quoting was required, really would be a little bit more helpful than the current one which appears to work and update something, but updates the wrong thing. |
We've had user reports saying the exact opposite in the past, unfortunately 🙁 This is one of those cases where you can't please everyone, no matter how hard you try, unfortunately. |
Maybe one improvement could then be to make sure that the message doesn't include any command line that can be copy-pasted and executed directly, which would eliminate the problem of mistakenly updating the wrong thing. |
I just came to realize one thing, this message already includes unquoted spaces (and also the full path into the venv), if the Python interpreter is invoked through some nonstandard name, so if I were to do a $ 'te st/bin/python 3' -m pip install pip-install-test
Collecting pip-install-test
Using cached pip_install_test-0.5-py3-none-any.whl.metadata (979 bytes)
Using cached pip_install_test-0.5-py3-none-any.whl (1.7 kB)
Installing collected packages: pip-install-test
Successfully installed pip-install-test-0.5
[notice] A new release of pip is available: 24.3 -> 24.3.1
[notice] To update, run: /tmp/te st/bin/python 3 -m pip install --upgrade pip So it seems that the risk of outputting an unquoted space hasn't been a concern for the current implementation and that a really straightforward improvement could be to treat an invocation from inside of a venv the same as using a nonstandard interpreter name. |
Second that. |
See related discussion: #12411, #12412, #10987, #10734
Can you give a concrete example of your suggestion, what it looks like now, what it would look like after. I'm struggling to follow your reasoning here, as currently it is accepted to have an unquoted space because it is not a goal to copy and paste, but meant to be illustrative for the user. I'd need to see real examples to see if what you're suggesting improves the illustrativeness for users. |
Sure. Currently the message looks like this:
The problem with that is that even if it isn't intended to be copy-pasted it very much looks as if it is and when someone does copy-paste it, it (in pretty much every normal enviroment) is a valid command line that performs an upgrade and looks as if it did the right thing, even when it didn't upgrade the installation inside of the venv, but another one. My two suggestions for possible ways to eliminate that problem are:
If you want to stress that this command line isn't supposed to be copy-pasted, you'd probably prefer 1), but anyone who finds it convenient to be able to copy-paste the command line will probably prefer 2). |
Description
When using
venv
andpip
like this:Then that command line isn't directly copy-pasteable, as it doesn't include the required path to the venv.
Expected behavior
It'd be more helpful if the command line was directly copy-pasteable, including the venv path (when needed).
pip version
24.3.0
Python version
3.12.7
OS
Linux
How to Reproduce
Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: