Skip to content

Conversation

@ashioyajotham
Copy link

Fixes #339: Interactive Plotly figures fail to render with ipywidget error.

Automatically sets the Plotly renderer to 'plotly_mimetype' on first code execution per kernel session, enabling interactive Plotly charts to render correctly in VS Code when connected to a Colab runtime.

Implementation:

  • Created plotly-config.ts module to inject Plotly config code
  • Modified colab-proxy-web-socket.ts to intercept execute_request messages
  • Uses try/except to gracefully handle cases where Plotly is not installed
  • Only configures on first execute_request per session (idempotent)
  • Follows existing pattern from drive-mount-warning.ts

Fixes googlecolab#339: Interactive Plotly figures fail to render with ipywidget error.

Automatically sets the Plotly renderer to 'plotly_mimetype' on first code
execution per kernel session, enabling interactive Plotly charts to render
correctly in VS Code when connected to a Colab runtime.

Implementation:
- Created plotly-config.ts module to inject Plotly config code
- Modified colab-proxy-web-socket.ts to intercept execute_request messages
- Uses try/except to gracefully handle cases where Plotly is not installed
- Only configures on first execute_request per session (idempotent)
- Follows existing pattern from drive-mount-warning.ts
@google-cla
Copy link

google-cla bot commented Dec 26, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@kevineger
Copy link
Member

Just as a paper trail, ongoing discussion on the ideal approach in the linked issue #339. But thanks for the initiative here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interactive Plotly Figures Fail to Render with ipywidget Error

2 participants