Skip to content
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

Limit traceback to one entry by default #11311

Open
1 task done
EpicWink opened this issue Jul 27, 2022 · 5 comments
Open
1 task done

Limit traceback to one entry by default #11311

EpicWink opened this issue Jul 27, 2022 · 5 comments
Labels
S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature

Comments

@EpicWink
Copy link
Contributor

What's the problem this feature will solve?

Large and unnecessary tracebacks in user bug-reports

Describe the solution you'd like

Set the trace-back limit sys.tracebacklimit to 1 by default. Don't set when verbose-logging (ie -vv passed at command-line). This includes build-backend subprocesses (in the vendored pep517 subprocess), but not when using an in-tree build-backend.

Alternative Solutions

None

Additional context

None

Code of Conduct

@EpicWink EpicWink added S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature labels Jul 27, 2022
@pradyunsg
Copy link
Member

I don't think they are unnecessary by any means. And, making the build-backend process fail gracefully is the responsibility of the build backend -- pip shouldn't be trying to cooerce their output to be shorter and potentially make it more difficult for the authors to diagnose issues.

@EpicWink
Copy link
Contributor Author

I think showing a traceback for expected failures confuses the user; example. I don't think it's reasonable for pip's authors to catch all known-possible exceptions and convert them to simple errors.

I think having the line of code which raises the exception in the bug-report is useful, allowing the maintainer to see where a fix needs to be applied. Ideally this would be the most inner line of code of pip or the build backend, but that is a little more complicated to implement. Perhaps tracebacklimit = 3 would cover most cases.

I can agree that leaving the error output up to the build backend makes sense, perhaps there should be some mechanism (cough config_settings) to send the user's current verbosity settings to the backend.

In any case, -vv would enable the whole traceback, and you can ask the user to re-run the install with this in the bug-report template.

@pradyunsg
Copy link
Member

Well, I think that is a case where we should update pip's presentation of errors and improve how we handle errors in the TOML file. I'll add a x-ref to #10421, for which this is a great candidate. Improving exactly this errors is on my TODO list of that effort, which I expect to come back to in the coming weeks.

@pfmoore
Copy link
Member

pfmoore commented Jul 27, 2022

Specifically with regard to build backend output, backends can write arbitrary output to stdout. Pip captures this, but doesn't parse it (we can't!) so we only have the option to display or not display. Not displaying backend errors would make it impossible for the user1 to know what happened. Now that we use rich for our output, maybe we could report the backend output in a different manner, to emphasise that it's supporting information (a lower-contrast colour, for example?)

Footnotes

  1. And even more importantly, if the user can't work out what's going on, the people the user goes to for help - who might well be capable of analysing the traceback.

@pradyunsg
Copy link
Member

FWIW, I do agree that we should be presenting our internal errors differently though. Something like rich's tracebacks could make sense for that. I have a draft patch somewhere, adding rich tracebacks and a PIP_RICH_TRACEBACKS=0, pip --no-rich-tracebacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

3 participants