friendly-traceback / friendly

Friendly-traceback's version used in most situations
https://friendly-traceback.github.io/docs/index.html
MIT License
40 stars 5 forks source link

Create an interactive display for tracebacks in Jupyter #5

Closed aroberge closed 3 years ago

aroberge commented 3 years ago

In Jupyter notebooks and lab, it might be useful to have a custom iPywidget interactive way to have all the information available in a collapsed form. This would allow to no longer recommend the "controversial" * import.

psychemedia commented 3 years ago

This presumable complements https://github.com/friendly-traceback/friendly/issues/3 which suggests a simple collapsible heading that states the error message as the heading with the traceback folded beneath it with a more elaborate ipywidget. The ipywidget framework supports two way callbacks between Python and Javascript environments and as such can be used to implement simple applications. What might such widget do / look like?

Perhaps related or useful to help guide thinking about what sorts of interaction or UI are possible are tools such as as nbtutor as well as notebook variable inspectors and debuggers?

aroberge commented 3 years ago

What I have in mind is inspired by Thonny's assistant image

However, the expandable elements would correspond to friendly's what(), where(), why(), as well as the traceback, all headed by the error message. There would be no need of two-way communications: everything would be computed at once and presented in a collapsed state, ready for expansion.

aroberge commented 3 years ago

I have implemented something which is not an iPywidget but works essentially as I was hoping it would. Unfortunately, it does not currently work with the dark theme and I cannot figure out why. More explanations can be found on a blog post I just published.

aroberge commented 3 years ago

After reading (again) the documentation about ipywidgets, especially about installing them, I note the following:

Most of the time, installing ipywidgets automatically configures Jupyter ...

Users of friendly are generally not expected to be experienced. Installing friendly should "just work", not simply most of the time, but all the time.

So, I will continue to work on an html-based solution, and should explore how rich deals with jupyter in an attempt to create a more robust solution.

aroberge commented 3 years ago

Other than for an extra (annoying) vertical space that I cannot seem to be able to get rid of, I am happy with the result shown on https://twitter.com/andre_roberge/status/1420733729497038848

psychemedia commented 3 years ago

Looks useful:-) My preference would be to reveal the text below, rather than above, the button. With text revealed above, the button moves, with text revealed below the button stays in the same place, (so in the latter case there is less distracting motion).

aroberge commented 3 years ago

Ok, I am quite sure I can do this.

aroberge commented 3 years ago

Closing this issue as I consider the implementation to be satisfactory.