docs: standardize supported dataframe backends across UI elements#9583
Conversation
Resolves docstring inconsistencies flagged in #9081 by using a uniform non-exhaustive phrasing — `(e.g., Polars, Pandas, PyArrow, Ibis, DuckDB)` — across `mo.ui.table`, `mo.ui.dataframe`, `mo.ui.data_explorer`, `mo.ui.altair_chart`, and `docs/api/inputs/dataframe.md`. `mo.ui.data_editor` is documented as eager-only since `_apply_edits_dataframe` uses narwhals' `eager_only=True`. `mo.ui.table.lazy` lists Polars LazyFrame, Ibis Table, and DuckDB Relation. Also fixes a `data_editor` bug where `_convert_value` deepcopied the input unconditionally — `DuckDBPyRelation` is not picklable. The deepcopy is only needed for the list/dict paths (they mutate in place); the dataframe path constructs a new native frame via narwhals. Closes coverage gaps by removing 10 `exclude=["pyarrow", "duckdb", "lazy-polars"]` sites in the `mo.ui.dataframe` tests and one `exclude=["duckdb"]` in the table bin-values test, plus adding parametrized smoke tests for `mo.ui.data_editor` and `mo.ui.dataframe`.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| data = self._data | ||
| if isinstance(data, (list, dict)): | ||
| data = deepcopy(data) | ||
| return apply_edits(data, value) |
There was a problem hiding this comment.
small correctness fix when enabling more tests
There was a problem hiding this comment.
Pull request overview
Standardizes the docstring phrasing for supported dataframe backends across the dataframe-accepting UI elements, fixes a data_editor._convert_value bug where unconditional deepcopy broke non-picklable inputs like DuckDBPyRelation, and expands parametrized test coverage to additional backends (PyArrow, DuckDB, lazy Polars) where applicable.
Changes:
- Uniform docstring wording
(e.g., Polars, Pandas, PyArrow, Ibis, DuckDB)fortable,dataframe,data_explorer,altair_chart, anddata_editor(eager-only);table.lazylists lazy backends. data_editor._convert_valueonly deepcopies for list/dict inputs; dataframe inputs are passed through to narwhals.- Removed many
exclude=[...]parametrize narrowings in dataframe tests and the bin-values null test; added new parametrized backend coverage tests fordata_editoranddataframe.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| marimo/_plugins/ui/_impl/table.py | Standardized table data sources docstring; updated lazy to mention Polars/Ibis/DuckDB lazy types. |
| marimo/_plugins/ui/_impl/dataframes/dataframe.py | Standardized supported-backends wording. |
| marimo/_plugins/ui/_impl/data_explorer.py | Standardized df arg docstring. |
| marimo/_plugins/ui/_impl/altair_chart.py | Standardized supported-backends wording (now also lists Ibis/DuckDB). |
| marimo/_plugins/ui/_impl/data_editor.py | Eager-only docstring; skip deepcopy for dataframe path to support non-picklable frames. |
| docs/api/inputs/dataframe.md | Updated install note to reference any supported dataframe library. |
| tests/_plugins/ui/_impl/test_table.py | Dropped exclude=["duckdb"] in bin-values null test. |
| tests/_plugins/ui/_impl/test_data_editor.py | Added parametrized backend coverage for eager backends. |
| tests/_plugins/ui/_impl/dataframes/test_dataframe.py | Added round-trip backend test; removed many backend exclusions; added pyarrow/duckdb expected schema variant. |
There was a problem hiding this comment.
No issues found across 9 files
Architecture diagram
sequenceDiagram
participant UI as UI Element
participant Table as mo.ui.table
participant LazyTable as mo.ui.table.lazy
participant DataEditor as mo.ui.data_editor
participant DFExplorer as mo.ui.data_explorer
participant AltairChart as mo.ui.altair_chart
participant DataFrame as mo.ui.dataframe
participant Narwhals as Narwhals Library
participant Backend as Dataframe Backend
Note over UI,Backend: Supported dataframe backends across all UI elements
UI->>DataFrame: Create with dataframe
DataFrame->>Narwhals: Convert to narwhals type
Narwhals-->>DataFrame: Generic dataframe wrapper
DataFrame->>Backend: Support Polars, Pandas, PyArrow, Ibis, DuckDB
Backend-->>DataFrame: Native dataframe operations
UI->>Table: Create with dataframe
Table->>Narwhals: Convert to narwhals type
Narwhals-->>Table: Generic dataframe wrapper
Table->>Backend: Support Polars, Pandas, PyArrow, Ibis, DuckDB
UI->>LazyTable: Create with lazy dataframe
LazyTable->>Backend: Support Polars LazyFrame, Ibis Table, DuckDB Relation
UI->>DataEditor: Create with eager dataframe
DataEditor->>DataEditor: Check input type
alt Input is list or dict
DataEditor->>DataEditor: deepcopy for mutation safety
else Input is dataframe
DataEditor->>DataEditor: Skip deepcopy (not picklable for some backends)
DataEditor->>Narwhals: Apply edits with eager_only=True
Narwhals-->>DataEditor: New native dataframe
end
DataEditor-->>UI: Edited result
UI->>DFExplorer: Create with dataframe
DFExplorer->>Backend: Support Polars, Pandas, PyArrow, Ibis, DuckDB
UI->>AltairChart: Create with dataframe
AltairChart->>Backend: Support Polars, Pandas, PyArrow, Ibis, DuckDB
Note over DataFrame: Construction round-trips to original type
DataFrame->>Backend: Native backend
Backend-->>DataFrame: Original type preserved
Note over DataEditor: Edit operations produce same type
UI->>DataEditor: Apply edit
DataEditor->>Narwhals: Convert and apply with eager_only=True
Narwhals-->>DataEditor: New dataframe
alt Eager backend (Polars, Pandas, PyArrow)
DataEditor-->>UI: Output same type as input
else Lazy/relation backend (Ibis, DuckDB)
Note over DataEditor: Not supported (throws error)
end
|
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.7-dev55 |
Closes #9081
Resolves docstring inconsistencies flagged in #9081 by using a uniform
non-exhaustive phrasing —
(e.g., Polars, Pandas, PyArrow, Ibis, DuckDB)—across
mo.ui.table,mo.ui.dataframe,mo.ui.data_explorer,mo.ui.altair_chart, anddocs/api/inputs/dataframe.md.mo.ui.data_editoris documented as eager-only since
_apply_edits_dataframeuses narwhals'eager_only=True.mo.ui.table.lazylists Polars LazyFrame, Ibis Table,and DuckDB Relation.
Also fixes a
data_editorbug where_convert_valuedeepcopied the inputunconditionally —
DuckDBPyRelationis not picklable. The deepcopy is onlyneeded for the list/dict paths (they mutate in place); the dataframe path
constructs a new native frame via narwhals.
Closes coverage gaps by removing 10
exclude=["pyarrow", "duckdb", "lazy-polars"]sites in themo.ui.dataframetests and oneexclude=["duckdb"]in the table bin-values test, plus adding parametrizedsmoke tests for
mo.ui.data_editorandmo.ui.dataframe.