Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: remove side-effectful isinstance check (#1779)

Akshay Agrawal139b0a018175
diff --git a/marimo/_plugins/ui/_impl/tables/types.py b/marimo/_plugins/ui/_impl/tables/types.py
index f3c97b07bf..1af73d6383 100644
--- a/marimo/_plugins/ui/_impl/tables/types.py
+++ b/marimo/_plugins/ui/_impl/tables/types.py
@@ -1,12 +1,11 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
-from typing import Protocol, runtime_checkable
+from typing import Protocol
from marimo._plugins.ui._impl.tables.dataframe_protocol import DataFrame
-@runtime_checkable
class DataFrameLike(Protocol):
def __dataframe__(
self, nan_as_null: bool = False, allow_copy: bool = True
@@ -15,8 +14,7 @@ class DataFrameLike(Protocol):
def is_dataframe_like(value: object) -> bool:
return (
- isinstance(value, DataFrameLike)
- and hasattr(value, "__dataframe__")
+ hasattr(value, "__dataframe__")
and callable(value.__dataframe__)
# By checking these are equal, we likely guarding against
# __getattr__ implementations that may return different callables