jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.52k stars 4.82k forks source link

Better traceback. #1247

Open Carreau opened 8 years ago

Carreau commented 8 years ago

Again, JupyterDay Boston,

I had also many request for "HTML expandable tracebacks". This might be more an IPython issue, i just don't remember if tracebacks support mimetype in notebooks.

takluyver commented 8 years ago

We had talked about adding a new message type for errors with a mimebundle (the present error message only has a text traceback).

Thinking about it more, I'm not sure we need a new message type: maybe messages should just display with display_data, and then execute_reply with status error is the programmatic indicator that it failed.

minrk commented 8 years ago

I don't recall a proposal for a new message type. My understanding of the plan was to extend the existing error message with richer data (possibly mimebundle, possibly structured in a more traceback-centric way), so that exceptions can be better rendered.

takluyver commented 8 years ago

Oh, that may have been it. A backward-compatible change to the message spec, anyway.

If we do want to use a mimebundle (which I think is a simple enough extension), I think it's worth considering just doing that with the existing display_data message, though - I'm not sure there's any reason to add a mimebundle to error messages.

minrk commented 8 years ago

There is a reason to add it to the same message in that I think it would make it simpler to do a backward-compatible upgrade without anyone displaying a traceback twice. That might not be true, though; I haven't though about it thoroughly.

takluyver commented 8 years ago

I was thinking of just switching over to display_data messages and dropping the use of error messages entirely. There's still the execute_reply to provide a programmatic indication that execution failed.

JamiesHQ commented 7 years ago

cc @gnestor

gnestor commented 7 years ago

If I understand correctly, this (custom mimetype and renderer for errors and tracebacks) is already implemented in jupyterlab:

image

As for "expandable" tracebacks, that sounds cool and I'd be willing to work on it.

The question: Should we implement this in classic notebook or dedicate our resources to jupyterlab?

jankatins commented 7 years ago

The jupyter extension repo has a plugin, which does some visual stuff to a traceback: http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/skip-traceback/readme.html

gnestor commented 7 years ago

This is a perfect application for a mime renderer extension. As stated above, jupyterlab ships with one, but it appears like it only modifies the background color of the output area. This skip-traceback extensions makes me think that we could do a lot better. We could provide an accordion like UI for tracebacks, error styles, and potentially auto-link references to local file resources. Another great thing about mime renderer extensions: they work for all kernels, so as long at kernels use display_data messages to return errors and conform to a standard spec for this custom mimetype, then all kernels can display errors in very nice way.

cc @ellisonbg @jasongrout @blink1073 @afshin