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
Add debugger variable renderer based on mime type #10299
Conversation
Thanks for making a pull request to JupyterLab! To try out this branch on binder, follow this link: |
Thanks! Mind adding a quick screencast or screenshot to the description to have a quick idea of what it looks like?? |
Nice, thanks for sharing! |
This looks wonderful! One design point: the context menus are not greatly discoverable. Would it be a good idea to add a button on the listing to expose this feature more? For example, RStudio has small icons on the right-hand side of the variable explorer: Edit: to clarify I did run the binder when this PR was originally opened and could not find a way to display the preview so gave up (I did not have time to look at the code first); if seasoned users cannot find it, newbies won't either. |
Looks like it also needs a lint pass: https://github.com/jupyterlab/jupyterlab/pull/10299/checks?check_run_id=2717509547 |
How can we test this? Does it need a new version of xeus or some other component? Binder gives me:
|
It requires xeus-python master, but it is basically a chicken and egg situation. I presume it is safe to release xeus-python with this when this gets merged. |
Is there a link to that proposal? Or maybe a work-in progress PR adding it to |
For now this is what it looks like on Binder if the kernel does not support the feature: rich-inspect-variable-binder.mp4 |
* @param variablesReference The variable reference to request | ||
* @returns The mime renderer data model | ||
*/ | ||
inspectRichVariable( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The debug message is called richInspectVariables
, should the public method on the service named the same (in singular form)?
Not strong opinion, just raising the question before this gets in the pubic IDebugger
API.
Thanks for testing @jtpio I swiched the PR to draft as indeed it does not make much sense without having a feedback from the kernel to know if the feature is supported or not => waiting on @JohanMabille for that part.
Actually this is not the case for some other messages
I switches the word because I like the convention of starting a method with a verb. But as it is not listed in the project style guidelines, I'm fine switch to your proposal. Side note: the example highlights an unfortunate choice of words as a method and a request have the same name without being related. |
Right, the |
xeus-python 0.12.5 has been released. It has full support for the |
Thanks @fcollonval. Just tried on Binder and the following code snippet: from ipywidgets import IntSlider
slider = IntSlider()
slider Gives the following behavior: rich-variable-not-supported.mp4This is with |
Would it be that you are using the stable ipywidgets library? It works only with the upcoming version v8 for widgets. |
Yes it was with the latest stable ipywidgets 7.6.4. Works well with the latest prerelease 👍 I guess it would be fine to ship it before ipywidgets 8.0 is out. It will not be optimal to ipywidgets 7 users, but will work for other mime types. |
@@ -672,12 +770,12 @@ export namespace IDebugger { | |||
/** | |||
* Signal emitted when the current frame has changed. | |||
*/ | |||
readonly currentFrameChanged: ISignal<this, IDebugger.IStackFrame>; | |||
readonly currentFrameChanged: ISignal<this, IDebugger.IStackFrame | null>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's tag as api-change
since there are a couple of signature changes in the public interfaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
In that case we might have to bump to the 4.0 milestone. |
I think we can bump to 4.0 as the lifecycle of the panels need improvements for it to be really useful - the current behavior close the panel each time the notebook changes. |
OK switching to 4.0 then. |
Thank you! |
This pull request has been mentioned on Jupyter Community Forum. There might be relevant details there: https://discourse.jupyter.org/t/how-to-use-debugger-in-jupyterlab/11275/14 |
@meeseeksdev please backport to 3.3.x |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
Status :
Waiting on #10406 to ensure no visual regressioni won't have time to address #10406. This can be merged if approved.
References
Xeus-python is providing a new debug message to get a rich variable representation:
jupyter-xeus/xeus-python#446
Fixes #9867
This adds a command and a panel to display such rich variable.
Code changes
User-facing changes
New context menu on the variable explorer. It has one entry on the tree view to render the variable based on mime type information. And on the grid view it has a second entry to inspect the object
The rich renderer can also be triggered from an action button displayed on hover in the tree view.
Backwards-incompatible changes
N/A