Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4134750
feat: Disable progress bars in Anywidget mode to reduce notebook clutter
shuoweil Feb 5, 2026
3b7ce8e
feat: guard polar engine
shuoweil Feb 6, 2026
6d42400
Merge branch 'main' into shuowei-anywidget-disable-log
shuoweil Feb 6, 2026
196c111
fix: Implement safe JSON decoding in Polars compiler
shuoweil Feb 6, 2026
56383f5
chore: suppress JSONDtypeWarning in TableWidget
shuoweil Feb 6, 2026
fd978af
chore: suppress JSONDtypeWarning in Anywidget display mode
shuoweil Feb 6, 2026
15e0382
fix: avoid accessing dtypes in DataFrame.columns to prevent premature…
shuoweil Feb 6, 2026
afa099b
fix: remove initial 'Starting.' message from progress bars
shuoweil Feb 6, 2026
a68d818
fix: suppress JSONDtypeWarning in _get_display_df_and_blob_cols
shuoweil Feb 6, 2026
44dedaa
fix: revert warning suppression in dataframe.py to strictly limit to …
shuoweil Feb 6, 2026
ea81d06
Merge branch 'main' into shuowei-anywidget-disable-warning
shuoweil Feb 6, 2026
4bf00da
fix: fix regression in DataFrame.columns returning flat Index for Mul…
shuoweil Feb 6, 2026
33e1d4e
chore: suppress future warning
shuoweil Feb 6, 2026
647927f
chore: suppress python version support warnings
shuoweil Feb 6, 2026
4740708
revert: Roll back to state at 41347509f
shuoweil Feb 6, 2026
f02f304
Merge branch 'main' into shuowei-anywidget-disable-log
shuoweil Feb 6, 2026
1e5f52a
test: pass the session in
shuoweil Feb 6, 2026
f162040
chore: remove all unrealted change
shuoweil Feb 6, 2026
4ce97d5
chore: move the place to take fflag
shuoweil Feb 6, 2026
191dbdd
chore: suppress JSONDtypeWarning in TableWidget
shuoweil Feb 6, 2026
0e3d8cf
chore: suppress JSONDtypeWarning in Anywidget display mode
shuoweil Feb 6, 2026
3a116ad
fix: avoid accessing dtypes in DataFrame.columns to prevent premature…
shuoweil Feb 6, 2026
820fa26
fix: suppress JSONDtypeWarning in _get_display_df_and_blob_cols
shuoweil Feb 6, 2026
104a7cf
fix: revert warning suppression in dataframe.py to strictly limit to …
shuoweil Feb 6, 2026
1f3a6d7
chore: suppress future warning
shuoweil Feb 6, 2026
6ebb05d
chore: suppress python version support warnings
shuoweil Feb 6, 2026
52aef7f
fix: fix regression in DataFrame.columns returning flat Index for Mul…
shuoweil Feb 6, 2026
726d150
test: pass session into astype tests
shuoweil Feb 6, 2026
e7a9478
fix: address review comment in formatting_helpers.py
shuoweil Feb 6, 2026
ee26056
refactor: simplify TableWidget constructor
shuoweil Feb 6, 2026
f0e86aa
Merge branch 'shuowei-anywidget-disable-future-warnings' into shuowei…
shuoweil Feb 6, 2026
713c83b
fix: move warning suppression to top of __init__
shuoweil Feb 6, 2026
c807194
Merge branch 'main' into shuowei-anywidget-disable-warning
shuoweil Feb 6, 2026
7cc991e
Merge branch 'main' into shuowei-anywidget-disable-warning
shuoweil Feb 6, 2026
f48b69b
Merge branch 'main' into shuowei-anywidget-disable-warning
shuoweil Feb 7, 2026
e6f5b76
refactor: simplify warning suppression by relying on global filter
shuoweil Feb 7, 2026
3d3bc2d
Merge branch 'main' into shuowei-anywidget-disable-warning
shuoweil Feb 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions bigframes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,26 @@

"""BigQuery DataFrames provides a DataFrame API scaled by the BigQuery engine."""

from bigframes._config import option_context, options
from bigframes._config.bigquery_options import BigQueryOptions
from bigframes.core.global_session import close_session, get_global_session
import bigframes.enums as enums
import bigframes.exceptions as exceptions
from bigframes.session import connect, Session
from bigframes.version import __version__
import warnings

# Suppress Python version support warnings from google-cloud libraries.
# These are particularly noisy in Colab which still uses Python 3.10.
warnings.filterwarnings(
"ignore",
category=FutureWarning,
message=".*Google will stop supporting.*Python.*",
)

from bigframes._config import option_context, options # noqa: E402
from bigframes._config.bigquery_options import BigQueryOptions # noqa: E402
from bigframes.core.global_session import ( # noqa: E402
close_session,
get_global_session,
)
import bigframes.enums as enums # noqa: E402
import bigframes.exceptions as exceptions # noqa: E402
from bigframes.session import connect, Session # noqa: E402
from bigframes.version import __version__ # noqa: E402

_MAGIC_NAMES = ["bqsql"]

Expand Down
2 changes: 1 addition & 1 deletion bigframes/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def dtypes(self) -> pandas.Series:

@property
def columns(self) -> pandas.Index:
return self.dtypes.index
return self._block.column_labels

@columns.setter
def columns(self, labels: pandas.Index):
Expand Down
30 changes: 20 additions & 10 deletions bigframes/display/anywidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import threading
from typing import Any, Iterator, Optional
import uuid
import warnings

import pandas as pd

Expand Down Expand Up @@ -111,23 +112,32 @@ def __init__(self, dataframe: bigframes.dataframe.DataFrame):
self.page_size = initial_page_size
self.max_columns = initial_max_columns

# TODO(b/469861913): Nested columns from structs (e.g., 'struct_col.name') are not currently sortable.
# TODO(b/463754889): Support non-string column labels for sorting.
if all(isinstance(col, str) for col in dataframe.columns):
self.orderable_columns = [
str(col_name)
for col_name, dtype in dataframe.dtypes.items()
if dtypes.is_orderable(dtype)
]
else:
self.orderable_columns = []
self.orderable_columns = self._get_orderable_columns(dataframe)

self._initial_load()

# Signals to the frontend that the initial data load is complete.
# Also used as a guard to prevent observers from firing during initialization.
self._initial_load_complete = True

def _get_orderable_columns(
self, dataframe: bigframes.dataframe.DataFrame
) -> list[str]:
"""Determine which columns can be used for client-side sorting."""
# TODO(b/469861913): Nested columns from structs (e.g., 'struct_col.name') are not currently sortable.
# TODO(b/463754889): Support non-string column labels for sorting.
if not all(isinstance(col, str) for col in dataframe.columns):
return []

with warnings.catch_warnings():
warnings.simplefilter("ignore", bigframes.exceptions.JSONDtypeWarning)
warnings.simplefilter("ignore", category=FutureWarning)
return [
str(col_name)
for col_name, dtype in dataframe.dtypes.items()
if dtypes.is_orderable(dtype)
]

def _initial_load(self) -> None:
"""Get initial data and row count."""
# obtain the row counts
Expand Down
8 changes: 7 additions & 1 deletion bigframes/display/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,13 @@ def repr_mimebundle(

if opts.repr_mode == "anywidget":
try:
return get_anywidget_bundle(obj, include=include, exclude=exclude)
with bigframes.option_context("display.progress_bar", None):
with warnings.catch_warnings():
warnings.simplefilter(
"ignore", category=bigframes.exceptions.JSONDtypeWarning
)
warnings.simplefilter("ignore", category=FutureWarning)
return get_anywidget_bundle(obj, include=include, exclude=exclude)
except ImportError:
# Anywidget is an optional dependency, so warn rather than fail.
# TODO(shuowei): When Anywidget becomes the default for all repr modes,
Expand Down
17 changes: 8 additions & 9 deletions bigframes/pandas/io/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,14 @@ def _read_gbq_colab(
)
_set_default_session_location_if_possible_deferred_query(create_query)
if not config.options.bigquery._session_started:
with warnings.catch_warnings():
# Don't warning about Polars in SQL cell.
# Related to b/437090788.
try:
bigframes._importing.import_polars()
warnings.simplefilter("ignore", bigframes.exceptions.PreviewWarning)
config.options.bigquery.enable_polars_execution = True
except ImportError:
pass # don't fail if polars isn't available
# Don't warning about Polars in SQL cell.
# Related to b/437090788.
try:
bigframes._importing.import_polars()
warnings.simplefilter("ignore", bigframes.exceptions.PreviewWarning)
config.options.bigquery.enable_polars_execution = True
except ImportError:
pass # don't fail if polars isn't available

return global_session.with_default_session(
bigframes.session.Session._read_gbq_colab,
Expand Down
Loading