Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.

fix: Correct DataFrame widget rendering in Colab#2319

Merged
tswast merged 7 commits intomainfrom
shuowei-anywidget-fix-display-colab
Dec 12, 2025
Merged

fix: Correct DataFrame widget rendering in Colab#2319
tswast merged 7 commits intomainfrom
shuowei-anywidget-fix-display-colab

Conversation

@shuoweil
Copy link
Copy Markdown
Contributor

@shuoweil shuoweil commented Dec 9, 2025

This PR fix the _get_anywidget_bundle method. Previously, when the underlying widget's repr_mimebundle method returned a (data, metadata) tuple, the code was only extracting the data portion and discarding the metadata. This resulted in the widget not rendering correctly in environments like Colab, which rely on this metadata.

The change corrects this by properly unpacking the tuple into widget_repr and widget_metadata. The method now preserves the metadata and returns it along with the data, ensuring that the necessary information for widget rendering is passed on.

We also revert commit 4df3428 to reapply "refactor: Migrate DataFrame display to use IPython's repr_mimebundle() protocol for anywidget mode (#2271)"

A testcase is added to verify this new change. We also verified at colab: screen/AzGa5RMTJnMH5NH

Fixes #<466155761> 🦕

@shuoweil shuoweil requested review from a team and tswast December 9, 2025 23:48
@review-notebook-app
Copy link
Copy Markdown