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.

improvement: release data-editor out of experimental (#4470)

Myles Scolnick1a60ef12dbcb
diff --git a/marimo/_plugins/ui/__init__.py b/marimo/_plugins/ui/__init__.py
index 6696cf2e2b..1043d12626 100644
--- a/marimo/_plugins/ui/__init__.py
+++ b/marimo/_plugins/ui/__init__.py
@@ -13,6 +13,7 @@ __all__ = [
"chat",
"checkbox",
"code_editor",
+ "data_editor",
"data_explorer",
"dataframe",
"date_range",
@@ -46,7 +47,8 @@ from marimo._plugins.ui._impl.array import array
from marimo._plugins.ui._impl.batch import batch
from marimo._plugins.ui._impl.chat.chat import chat
from marimo._plugins.ui._impl.data_editor import (
- data_editor as experimental_data_editor,
+ data_editor,
+ experimental_data_editor,
)
from marimo._plugins.ui._impl.data_explorer import data_explorer
from marimo._plugins.ui._impl.dataframes.dataframe import dataframe
diff --git a/marimo/_plugins/ui/_impl/data_editor.py b/marimo/_plugins/ui/_impl/data_editor.py
index 94f0d92926..04e7dc8ceb 100644
--- a/marimo/_plugins/ui/_impl/data_editor.py
+++ b/marimo/_plugins/ui/_impl/data_editor.py
@@ -25,6 +25,7 @@ from marimo._output.rich_help import mddoc
from marimo._plugins.ui._core.ui_element import UIElement
from marimo._plugins.ui._impl.tables.utils import get_table_manager
from marimo._plugins.validators import validate_page_size
+from marimo._utils.deprecated import deprecated
LOGGER = _loggers.marimo_logger()
@@ -71,6 +72,16 @@ RowOrientedData = list[dict[str, Any]]
ColumnOrientedData = dict[str, list[Any]]
+@deprecated(
+ "mo.ui.experimental_data_editor is deprecated. Use mo.ui.data_editor instead"
+)
+def experimental_data_editor(
+ *args: Any,
+ **kwargs: Any,
+) -> data_editor:
+ return data_editor(*args, **kwargs)
+
+
@mddoc
class data_editor(
UIElement[
@@ -96,21 +107,21 @@ class data_editor(
import pandas as pd
df = pd.DataFrame({"A": [1, 2, 3], "B": ["a", "b", "c"]})
- editor = mo.ui.experimental_data_editor(data=df, label="Edit Data")
+ editor = mo.ui.data_editor(data=df, label="Edit Data")
```
Create a data editor from a list of dicts:
```python
data = [{"A": 1, "B": "a"}, {"A": 2, "B": "a"}, {"A": 3, "B": "c"}]
- editor = mo.ui.experimental_data_editor(data=data, label="Edit Data")
+ editor = mo.ui.data_editor(data=data, label="Edit Data")
```
Create a data editor from a dict of lists:
```python
data = {"A": [1, 2, 3], "B": ["a", "b", "c"]}
- editor = mo.ui.experimental_data_editor(data=data, label="Edit Data")
+ editor = mo.ui.data_editor(data=data, label="Edit Data")
```
Attributes:
diff --git a/marimo/_smoke_tests/editable_df.py b/marimo/_smoke_tests/editable_df.py
index 71f44155bf..05ab3ee5db 100644
--- a/marimo/_smoke_tests/editable_df.py
+++ b/marimo/_smoke_tests/editable_df.py
@@ -57,7 +57,7 @@ def __(column_oriented, mo, pandas_df, polars_df, row_oriented):
@app.cell
def __(df, mo):
- edited = mo.ui.experimental_data_editor(df.value)
+ edited = mo.ui.data_editor(df.value)
edited
return (edited,)
@@ -117,7 +117,7 @@ def __(pl, varying_data):
@app.cell
def __(mo, pl, varying_data):
- edited_df = mo.ui.experimental_data_editor(pl.DataFrame(varying_data))
+ edited_df = mo.ui.data_editor(pl.DataFrame(varying_data))
edited_df
return (edited_df,)
diff --git a/marimo/_smoke_tests/tables/rich_elements.py b/marimo/_smoke_tests/tables/rich_elements.py
index e6182f4042..c8490fcd54 100644
--- a/marimo/_smoke_tests/tables/rich_elements.py
+++ b/marimo/_smoke_tests/tables/rich_elements.py
@@ -208,7 +208,7 @@ def _(mo, pd, pl):
@app.cell
def _(data, mo):
- mo.ui.experimental_data_editor(data=data, label="Edit Data")
+ mo.ui.data_editor(data=data, label="Edit Data")
return
diff --git a/tests/_plugins/ui/_impl/test_data_editor.py b/tests/_plugins/ui/_impl/test_data_editor.py
index 0f11b8134a..3fe55e0a99 100644
--- a/tests/_plugins/ui/_impl/test_data_editor.py
+++ b/tests/_plugins/ui/_impl/test_data_editor.py
@@ -14,7 +14,7 @@ from marimo._plugins.ui._impl.data_editor import (
apply_edits,
)
-data_editor = ui.experimental_data_editor
+data_editor = ui.data_editor
HAS_PANDAS = DependencyManager.pandas.has()
HAS_POLARS = DependencyManager.polars.has()
diff --git a/tests/mocks.py b/tests/mocks.py
index c9f00530e0..87e261162c 100644
--- a/tests/mocks.py
+++ b/tests/mocks.py
@@ -76,7 +76,7 @@ def snapshotter(current_file: str) -> Callable[[str, str], None]:
)
)
- if text_diff:
+ if text_diff != "":
write_result()
print("Snapshot updated")
diff --git a/tests/snapshots/api.txt b/tests/snapshots/api.txt
index 3b32214754..ebf1e71795 100644
--- a/tests/snapshots/api.txt
+++ b/tests/snapshots/api.txt
@@ -85,6 +85,7 @@ ui
chat
checkbox
code_editor
+ data_editor
data_explorer
dataframe
date