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

Python: Add support for additional widget types (in viewer or plots pane) #1924

Closed
isabelizimm opened this issue Dec 6, 2023 · 7 comments
Closed

Comments

@isabelizimm
Copy link
Contributor

isabelizimm commented Dec 6, 2023

Once #1918 is merged, we will have basic support for the widgets such as ipywidgets, ipydatagrid, and ipyleaflet in the plot pane. Still not working ❌ is:

  • %matplotlib widget mode
  • bqplot
  • ipycanvas
  • pythreejs
  • ipytree

Here is a gist of all the different widgets, for testing purposes

CC: @jgutman

@jgutman
Copy link
Contributor

jgutman commented Dec 11, 2023

@isabelizimm I imagine these were all tested prior to the switchover to the later version of html-manager, it might be worth us re-testing to see whether there are any changes in what works/what doesn't after the update -- we should also specify here the module version of the above widget types that we tested, since we know now that makes a difference to whether it's compatible or not

@jgutman jgutman changed the title Python: support ipywidget output in viewer and/or plots pane Python: Add support for additional widget types (in viewer or plots pane) Dec 11, 2023
@jgutman jgutman assigned jgutman and isabelizimm and unassigned jgutman Dec 11, 2023
@jgutman
Copy link
Contributor

jgutman commented Jan 16, 2024

In order to support matplotlib widgets and others that require a live Python kernel, we need to enable an actual non-stubbed RendererContext.

See current TODO in

// Some features known to be NYI:
// - Message passing between the renderer and the host (RenderContext)
// - Extending another renderer (RenderContext)
// - State management (RenderContext)
// - Raw Uint8Array data and blobs

and stubbed RendererContext

const vscode = acquireVsCodeApi();
import { activate } from "${rendererPath.toString()}"
// A stub implementation of RendererContext
var ctx = {
workspace: {
isTrusted: ${this._workspaceTrustManagementService.isWorkspaceTrusted()}
}
}
// Activate the renderer and create the data object
var renderer = activate(ctx);

Also see how this gets handled for ipywidgets in the jupyter extension
https://github.com/microsoft/vscode-jupyter/blob/4ca00b28cf3b890593e9c84d73b65e67f51a8061/src/webviews/webview-side/ipywidgets/renderer/index.ts#L244-L257

@peekxc
Copy link

peekxc commented Jul 5, 2024

Does this cover plotly / bokeh plots?

@juliasilge
Copy link
Contributor

@peekxc I believe that plotly works:

plotly

Are you observing something different?

For bokeh, I do not believe we have that working correctly right now (the plot opens in an external browser).

@peekxc
Copy link

peekxc commented Jul 6, 2024

For bokeh, I do not believe we have that working correctly right now (the plot opens in an external browser).

Ahh, I was talking about bokeh; sorry, I assumed the behavior would be identical

Screenshot 2024-07-06 at 9 21 29 AM

@seeM
Copy link
Contributor

seeM commented Aug 1, 2024

#4172 and #4208 should get the following widgets working:

  • anywidget
  • bqplot
  • drawdata
  • ipydatagrid
  • ipyleaflet
  • ipympl
  • ipytree
  • ipywidgets – all widget types except Output which needs special handling
  • pythreejs

There may be smaller issues with those, which we can log separately.

I haven't yet figured out why ipycanvas isn't working.

@testlabauto
Copy link
Contributor

Verified Fixed

Positron Version(s) : 2024.08.0-24
OS Version          : OSX

Test scenario(s)

Validated with everything here: https://gist.github.com/isabelizimm/02f7ba16dc74b202935f6d3e9ed6b892
Everything looks good except ipycanvas, which is noted above

Link(s) to TestRail test cases run or created:
N/A

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants