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

notebook kernel messaging and renderer messaging fixes #13401

Merged
merged 5 commits into from
Feb 21, 2024

Conversation

jonah-iden
Copy link
Contributor

@jonah-iden jonah-iden commented Feb 20, 2024

What it does

This implements the proposed Kernel messaging API (vscode.proposed.notebookMessaging.d.ts) and the notebookPreload contribution point. Also fixes notebook renderer messaging. This is to support interactive output widgets like for the ipywidgets library.

Tested with ipywidgets 7.8.1 and 8.1.2

How to test

  1. pip install ipywidgets in your used kernel
  2. Open a notebook
  3. add following cell
import ipywidgets as widgets
widgets.IntSlider(min=1, max=12)
  1. Execute the cell and see the interactive slider is rendered

Follow-ups

Review checklist

Reminder for reviewers

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good. I've confirmed that this works even for pretty complicated widgets such as:

a = widgets.FloatText()
b = widgets.FloatSlider()
display(a,b)

mylink = widgets.jslink((a, 'value'), (b, 'value'))

Before approving, I wanted to ask about this error. Have you seen that one when trying to execute a ipywidgets cell? If so, do you think it makes sense to fix it or leave it for a separate PR (I'd be fine with it, as it doesn't seem to impact behavior):

image

packages/notebook/src/browser/notebook-editor-widget.tsx Outdated Show resolved Hide resolved
packages/notebook/src/browser/notebook-editor-widget.tsx Outdated Show resolved Hide resolved
@jonah-iden
Copy link
Contributor Author

jonah-iden commented Feb 21, 2024

Thanks for the review. No, I did not see that fallbackToNextRenderer when testing ipywidgets.
since its coming from the ipywidgets renderer it could also be that there may be a python library missing or something like that
I think we can leave that for a separate PR

@jonah-iden jonah-iden force-pushed the jiden/notebook-kernel-messanging branch from 1c7f502 to 91da624 Compare February 21, 2024 15:32
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me 👍

This was referenced Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notebook issues related to notebooks
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants