Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on May 7, 2026. It is now read-only.

Commit 7813eaa

Browse filesBrowse files
authored
feat: add display.render_mode to control DataFrame/Series visualization (#2413)
This PR introduces the display.render_mode configuration option, providing a clearer and more flexible way to control how BigFrames objects are visualized in notebooks and other interactive environments. Key Changes: * New Configuration Option: Added bpd.options.display.render_mode which supports three modes: * html (Default): Standard HTML table rendering. * plaintext: Forces plain text output by removing the HTML component from the mimebundle. * anywidget: Enables the interactive anywidget-based table component. * Migration Path: Maintained backward compatibility for display.repr_mode = "anywidget". The rendering logic now checks both the new render_mode and the legacy repr_mode flags. * Notebook & Test Updates: Updated existing notebooks and system tests to prefer the new render_mode option while verifying that existing behaviors remain intact. * New Unit Tests: Added tests/unit/display/test_render_mode.py to specifically verify the mimebundle selection logic and priority across different configuration states. While repr_mode was previously used to toggle the interactive widget, "representation mode" is a broad term. render_mode specifically addresses the format of the output (HTML vs. Text vs. Widget), allowing for better support for text-only environments and a more intuitive API for users. Also verified at colab notebook: [screen/AHNz4o5Mhb9UHrh](https://screenshot.googleplex.com/AHNz4o5Mhb9UHrh) Fixes #<479282023> 🦕
1 parent bf68d0c commit 7813eaa
Copy full SHA for 7813eaa

8 files changed

+282-332Lines changed: 282 additions & 332 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎bigframes/display/html.py‎

Copy file name to clipboardExpand all lines: bigframes/display/html.py
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ def repr_mimebundle(
361361
if opts.repr_mode == "deferred":
362362
return repr_mimebundle_deferred(obj)
363363

364-
if opts.repr_mode == "anywidget":
364+
if opts.render_mode == "anywidget" or opts.repr_mode == "anywidget":
365365
try:
366366
with bigframes.option_context("display.progress_bar", None):
367367
with warnings.catch_warnings():
@@ -380,4 +380,8 @@ def repr_mimebundle(
380380
f"Falling back to static HTML. Error: {traceback.format_exc()}"
381381
)
382382

383-
return repr_mimebundle_head(obj)
383+
bundle = repr_mimebundle_head(obj)
384+
if opts.render_mode == "plaintext":
385+
bundle.pop("text/html", None)
386+
387+
return bundle

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.