pip: Better reporting on output from PEP 517 build backends
Currently, pip install and pip wheel on a PEP 517 compliant source tree hides all output on stdout and stderr from the build backend. Only if an error occurs, both are printed (though it sometimes misses parts of stdout). This means you can’t show the user any information about the progress of long compilations (or even that it’s still progressing and hasn’t got stuck anywhere). It also hides any warnings.
Is there any designated way to communicate from build backends to the user, and if not, would it be possible for pip to forward the stdout and/or stderr from build backends?
Running with -v is also problematic because it contains lots of noise, duplicates the build backend’s output in case of errors and prints an irrelevant stack trace. (Apparently, there’s no difference between -v, -vv and -vvv with pip install). The current output capturing also means that all tools checking for a tty won’t output any color, making error and log messages less readable.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (16 by maintainers)
These issues are no longer a concern. We’ve improved handling of output from the build-backends in 22.0 and also reduced the verbosity of a single
-vflag in releases since this issue was filed.I’m going to go ahead and close this now – I think we’re in a good spot w.r.t. output handling from build backends, but if folks think there’s specific improvements we can make, I’d like you to chip in at https://discuss.python.org/t/13779/ (you can log in via GitHub) since the relevant changes here likely affect more tools than just pip (at the very least, it affects build backends).
It seems like six different issues or proposed improvements are being mentioned:
setup.py cleantraceback isn’t neededInstallationErrortraceback at the end isn’t neededTo keep the discussions manageable, I think it would be best to separate these into different issues. Each one can be discussed separately, and any resolution / PR if it gets to that point could likely be implemented independent of the PR for any other. Here it seems like the interest is mainly in (4) and (5). I would suggest creating a new issue for each one you think should be addressed.
I started by creating an issue for (2) here: https://github.com/pypa/pip/issues/6642 (But I’m not completely sure it’s an issue after starting to investigate.)
pip installandpip wheelshould stop capturing stdout and stderr when calling the build backend.sys.stdout.isatty()andsys.stderr.isatty()should stay true if they were true for pip. If forwarding stdout is too verbose with other build backends, only stderr should be forwarded.Ideally, I think the combined output should look something like this, but with terminal colors and a progress bar that I can’t show in markdown:
Since we’ve already discussed it, the output of
pip install . -vshould become less verbose. I’d say at least the “Found link” / “Skipping link” lines and theInstallationErrorbacktrace should go away. The output of-vvand-vvvis fine, those can also keep showing backtraces.Afaik that traceback comes from the setup.py fallback at _internal/req/req_install.py
I think using
Building XYandSuccessfully build XY/Failed to build XYmakes a good delimiter. I’d like to avoid prefixing each line because that breaksisatty()and thereby terminal colors and progress bars.Totally agree; I opened the issue to discuss what the best solution for logging/error reporting would be. Just making pip not capture stdout and stderr took less time then writing up the initial post.
Sounds good to me @cjerdonek!
I think improving these things would be good, for a start. The second two seem pretty easy to address. (There is a separate issue to let people make the logs less noisy.)