jaraco / pip-run

pip-run - dynamic dependency loader for Python
MIT License
137 stars 19 forks source link

Emitting pip installer output by default is irritating #58

Closed jaraco closed 1 year ago

jaraco commented 1 year ago

In https://github.com/pypa/pip/issues/3971#issuecomment-1320927420, @pfmoore characterizes the issue:

I'm not in love with details like the default being to print all of pip's output, [contributing] to a general sense of "I never think to use it, because it's sort of alright, but irritating". What I want is to be able to type pip-run my_script.py arg1 arg2 arg3, and have it run my script with all dependencies available. The other features of pip-run are secondary (to me).

It is often super-useful to have the output emitted, because it provides a report of what was installed. This is great when copy/pasting for a bug report, because it provides a snapshot of the relevant package versions (and method of installation).

I've also bemoaned the fact that the output includes pip installer output by default. I'd very much prefer to suppress that output by default, but make it an option to re-enable.

Because that's not the case, I often invoke pip-run with -q to silence that behavior (which adds another annoyance to the experience, similar to #57. There's no clean, quiet experience.

The reason the behavior is because that's the default pip install behavior and pip-run is trying not to re-invent the interface but instead loosely couple with the existing interface. In that way, many other installer options are readily available, such as -v if you need more detail about why the install is failing, or --index or --use-pep517. Without that generalization, it would be a maintenance challenge (nightmare?) to keep up with the mapping between the pip-run UX and the pip install UX.

I'd be interested in making the install 'quiet by default', but I'm not sure how to do that safely and still honor the flags to pip install.

For instance, if pip-run were to set PIP_QUIET=1, does that have the intended effect? Can the user override that with -v?

I ran some quick tests and at first blush, it looks like everything works as one might expect, with the installer details being suppressed by default, but re-activated with -v, and -vvv has the same effect as -vv without PIP_QUIET.

So I think this one has an easy fix - set PIP_QUIET when invoking pip install.

pfmoore commented 1 year ago

The reason the behavior is because that's the default pip install behavior and pip-run is trying not to re-invent the interface but instead loosely couple with the existing interface.

IMO, that's where the problem lies. Pip's default behaviour is intended for its use as an installer. Which is definitely not the behaviour you want when using pip as a "behind the scenes" mechanism to set up dependencies. Using pip as a subcomponent like that is tricky to get right, and the CLI with all its complexity isn't optimal. Historical baggage and all that...

Sounds like PIP_QUIET would be a good fix for this particular one, though.