-
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
Better reporting on output from PEP 517 build backends #6634
Comments
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.) |
Thanks for filing this @konstin! I think that this is related to more granular support for logging, something in the scope of #6119. Preventing the duplicated output in verbose mode should be much easier to tackle independently though. PS: Put this in the wrong milestone; really need to move away from those. :) |
Also, what version of pip are you using? |
pip 19.1.1. However this isn't related to any particular pip or python release, e.g. pip 19.0 shows the same behaviour. |
Can you paste in an example of the duplicated output in case of errors using the latest pip (19.1.1), with the irrelevant stack trace you were referring to, when verbose mode is used? You should leave in pip's intro / prefix text for the subprocess calls and error but you can remove unrelated lines to make the paste shorter. |
I've created a gist with the full output: https://gist.github.com/konstin/20c5efdfcb87c34271dcc6157c684753. The find-links is for the wheel containing the build backend I'm working on. The interesting part:
I've just realized that the duplicate output is actually due to I can make a reproducible example tomorrow, if required. The project pyo3-pack and a |
What solution are you proposing? The problem I see is that if the output is shown by default, then that could be too noisy for most users. Are you suggesting an option "between" verbose and default, where the default log messages are shown, plus the output from the subprocesses? Or are you suggesting verbose showing less in general? (I do agree the tracebacks can be cleaned up, btw.) |
Is the first traceback actually from pip? It looks like that one is coming from the underlying subprocess. |
Maybe one way to improve the situation could be to better delineate the output from the subprocess, e.g. by prefixing each line or putting some kind of divider at the beginning and end. |
I'm marking this "discussion needed" instead of "awaiting PR" because I think it would be good to discuss what a PR should do before work goes into writing one. For example, some of the issues mentioned in the original post turned out not to be issues. Also, we might find that more than one improvement would be worth implementing, and so more than one PR. |
Sounds good to me @cjerdonek! |
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
Afaik that traceback comes from the setup.py fallback at _internal/req/req_install.py
I think using
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. |
It seems like six different issues or proposed improvements are being mentioned:
To 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: #6642 |
May I suggest the following solution, which seems to be minimally invasive: Allow the build backend to request However, by itself this is not enough: users usually don't specify any verbose options, and having no indication of any progress is less than ideal. I would therefore suggest to also add a non-standard method
This would allow |
I'm not sure this is possible, as PEP 517 backends run in a separate subprocess, and have no access to pip's logging streams, or any other parts of pip's internal details. The only way a frontend like pip can communicate with a backend is via (a) the stdio streams of the backend (and backends are explicitly allowed to place arbitrary data on their stdio streams), (b) the return code of the backend, or (c) any custom IPC mechanism that we (or rather the |
It is my understanding that PEP 517 puts the backend into a passive position, while giving the frontend full control over the process. Thus, the backend's job is merely to define and export function So, a minimal frontend could simply create file "runscript.py", and then launch a subprocess with
(or use the It is possible for the logger to use the stdout to pass its messages, provided they are formatted in a way that allows the frontend distinguish them from regular stdout output. Something like
P.S. I'm not very familiar with |
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 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). |
The 22.0 |
Currently,
pip install
andpip 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
withpip 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.The text was updated successfully, but these errors were encountered: