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.

tests: run more smoke tests in CI (#2058)

Myles Scolnick2e50ddc8c4f3
diff --git a/.github/workflows/test_cli.yaml b/.github/workflows/test_cli.yaml
index 309e1f521c..4ca810481b 100644
--- a/.github/workflows/test_cli.yaml
+++ b/.github/workflows/test_cli.yaml
@@ -35,21 +35,21 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
- cache: "pnpm"
- cache-dependency-path: "**/pnpm-lock.yaml"
+ cache: 'pnpm'
+ cache-dependency-path: '**/pnpm-lock.yaml'
- uses: turbocache-build/turbocache-action@v1
- name: 📦 Build frontend
run: make fe
env:
- NODE_OPTIONS: "--max_old_space_size=8192"
+ NODE_OPTIONS: '--max_old_space_size=8192'
- name: 🐍 Setup Python 3.10
uses: actions/setup-python@v5
with:
- python-version: "3.10"
- cache: "pip"
+ python-version: '3.10'
+ cache: 'pip'
- name: 🐍 Setup uv
uses: yezz123/setup-uv@v4
@@ -76,7 +76,7 @@ jobs:
strategy:
matrix:
# TODO(akshayka): consider adding 3.8, 3.9
- python-version: ["3.10"]
+ python-version: ['3.10']
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
@@ -87,7 +87,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- cache: "pip"
+ cache: 'pip'
- name: Install Python deps
run: |
@@ -116,11 +116,11 @@ jobs:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]
- uses: actions/checkout@v4
- - name: Set up Python 3.10
+ - name: Set up Python 3.12
uses: actions/setup-python@v5
with:
- python-version: "3.10"
- cache: "pip"
+ python-version: '3.12'
+ cache: 'pip'
- name: 🐍 Setup uv
uses: yezz123/setup-uv@v4
@@ -141,5 +141,3 @@ jobs:
- name: Test examples
shell: bash
run: pytest -v -s tests/_smoke_tests/run_all.py
- # TODO(msconick) remove continue-on-error when all tests pass
- continue-on-error: true
diff --git a/examples/data_explorer.py b/examples/data_explorer.py
index bff4882b75..59694afb5c 100644
--- a/examples/data_explorer.py
+++ b/examples/data_explorer.py
@@ -1,18 +1,18 @@
import marimo
-__generated_with = "0.6.0"
+__generated_with = "0.8.0"
app = marimo.App()
@app.cell
def __(mo):
- mo.md("# Data Explorer")
+ mo.md("""# Data Explorer""")
return
@app.cell
def __(mo):
- mo.md("This notebook lets you upload a CSV and plot its columns.")
+ mo.md("""This notebook lets you upload a CSV and plot its columns.""")
return
diff --git a/examples/requirements.txt b/examples/requirements.txt
index b4587486f6..8cb729259e 100644
--- a/examples/requirements.txt
+++ b/examples/requirements.txt
@@ -35,3 +35,10 @@ drawdata
anywidget
db-dtypes
google-cloud-storage
+quak
+dask
+ibis-framework[duckdb]
+pygwalker
+maplibre
+mosaic_widget
+geopandas
diff --git a/examples/third_party/duckdb_example.py b/examples/third_party/duckdb_example.py
index 103bcb5ceb..5e1569526a 100644
--- a/examples/third_party/duckdb_example.py
+++ b/examples/third_party/duckdb_example.py
@@ -1,6 +1,6 @@
import marimo
-__generated_with = "0.1.73"
+__generated_with = "0.8.0"
app = marimo.App(width="full")
@@ -8,11 +8,11 @@ app = marimo.App(width="full")
def __(mo):
mo.md(
"""
- # 🤗 Hugging Face dataset search and exploration
+ # 🤗 Hugging Face dataset search and exploration
- This notebook allows you to search and explore the datasets available on Hugging Face.
- First you can search for a dataset using the filters provided. Then you can select a dataset and explore the parquet files that are available for that dataset. Finally you can use the SQL editor to query the parquet files and the dataframe editor to explore the results of your query.
- """
+ This notebook allows you to search and explore the datasets available on Hugging Face.
+ First you can search for a dataset using the filters provided. Then you can select a dataset and explore the parquet files that are available for that dataset. Finally you can use the SQL editor to query the parquet files and the dataframe editor to explore the results of your query.
+ """
)
return
@@ -69,7 +69,7 @@ def __(all_tags, dataset_date_range, dataset_length, mo):
return stats,
[email protected](hide_code=True)
def __(all_tags, mo, stats):
# Search filters
search_filter = mo.ui.text_area(
@@ -77,7 +77,7 @@ def __(all_tags, mo, stats):
placeholder="Search for a dataset",
value="",
)
- tag_filter = mo.ui.dropdown(all_tags, label="Tag", full_width=True)
+ tag_filter = mo.ui.dropdown(all_tags[:10], label="Tag", full_width=True)
mo.hstack(
[stats, search_filter, tag_filter],
justify="start",
diff --git a/marimo/_smoke_tests/bugs/1351.py b/marimo/_smoke_tests/bugs/1351.py
index c908974a0a..b89f9cc718 100644
--- a/marimo/_smoke_tests/bugs/1351.py
+++ b/marimo/_smoke_tests/bugs/1351.py
@@ -2,7 +2,7 @@
import marimo
-__generated_with = "0.5.1"
+__generated_with = "0.8.0"
app = marimo.App()
@@ -19,16 +19,20 @@ def __(selected_theme):
import polars as pl
import holoviews as hv
import hvplot.polars
+
hv.extension("bokeh")
hvplot.extension("bokeh")
- hv.renderer('bokeh').theme = selected_theme.value
+ hv.renderer("bokeh").theme = selected_theme.value
return hv, hvplot, pl
@app.cell
def __(pl):
df = pl.DataFrame({"a": range(1, 10), "b": range(1, 10)})
- df.plot.line(x="a", y="b",)
+ df.plot.line(
+ x="a",
+ y="b",
+ )
return df,
diff --git a/marimo/_smoke_tests/bugs/1654-virtualize-multiselect.py b/marimo/_smoke_tests/bugs/1654-virtualize-multiselect.py
index 728c492cc6..f71b54c391 100644
--- a/marimo/_smoke_tests/bugs/1654-virtualize-multiselect.py
+++ b/marimo/_smoke_tests/bugs/1654-virtualize-multiselect.py
@@ -2,7 +2,7 @@
import marimo
-__generated_with = "0.7.19"
+__generated_with = "0.8.0"
app = marimo.App(app_title="1654 - Virtualize Multiselect")
@@ -57,7 +57,10 @@ def __(mo, xxl_list):
@app.cell
def __(mo, xxxl_list):
- mo.ui.multiselect(xxxl_list, label="XXXL list with 200K items")
+ try:
+ mo.ui.multiselect(xxxl_list, label="XXXL list with 200K items")
+ except ValueError as e:
+ print(e)
return
diff --git a/marimo/_smoke_tests/bugs/1711.py b/marimo/_smoke_tests/bugs/1711.py
index de489dfdaf..27b87d28d3 100644
--- a/marimo/_smoke_tests/bugs/1711.py
+++ b/marimo/_smoke_tests/bugs/1711.py
@@ -1,7 +1,8 @@
# Copyright 2024 Marimo. All rights reserved.
+
import marimo
-__generated_with = "0.6.25"
+__generated_with = "0.8.0"
app = marimo.App()
@@ -9,12 +10,16 @@ app = marimo.App()
def __():
import polars as pl
import numpy as np
- d = pl.DataFrame({"a": [np.arange(5) + i for i in range(5)]})
+
+ d = pl.DataFrame({"a": [np.array(np.arange(5) + i) for i in range(5)]})
res = d.select(
pl.col("a").map_batches(
- lambda x: {"filt_value": np.dot(x, x), "filt_phase": 5.0},
- is_elementwise=True),
- )
+ lambda x: pl.Series(
+ [{"filt_value": np.dot(x, x), "filt_phase": 5.0}], strict=False
+ ),
+ is_elementwise=True,
+ ),
+ )
return d, np, pl, res
diff --git a/marimo/_smoke_tests/dataframe.py b/marimo/_smoke_tests/dataframe.py
index 67d9f08808..1030390d7c 100644
--- a/marimo/_smoke_tests/dataframe.py
+++ b/marimo/_smoke_tests/dataframe.py
@@ -2,7 +2,7 @@
import marimo
-__generated_with = "0.7.12"
+__generated_with = "0.8.0"
app = marimo.App(width="full")
diff --git a/marimo/_smoke_tests/import_named_cells.py b/marimo/_smoke_tests/import_named_cells.py
index 7d6062464d..abb5cf7980 100644
--- a/marimo/_smoke_tests/import_named_cells.py
+++ b/marimo/_smoke_tests/import_named_cells.py
@@ -2,7 +2,7 @@
import marimo
-__generated_with = "0.2.8"
+__generated_with = "0.8.0"
app = marimo.App()
@@ -20,7 +20,7 @@ def __():
@app.cell
def __(mo):
- mo.md("**A cell that creates and shows a slider**")
+ mo.md("""**A cell that creates and shows a slider**""")
return
@@ -33,7 +33,7 @@ def __(display_slider):
@app.cell
def __(mo):
- mo.md("_Notice that set-ui-element value requests make it into the defs_")
+ mo.md("""_Notice that set-ui-element value requests make it into the defs_""")
return
@@ -51,7 +51,7 @@ def __(slider_defs):
@app.cell
def __(mo):
- mo.md("**A cell that shows a parametrizable UI element**")
+ mo.md("""**A cell that shows a parametrizable UI element**""")
return
diff --git a/marimo/_smoke_tests/third_party/altair_example.py b/marimo/_smoke_tests/third_party/altair_example.py
index 8133b450c0..49e91e9381 100644
--- a/marimo/_smoke_tests/third_party/altair_example.py
+++ b/marimo/_smoke_tests/third_party/altair_example.py
@@ -2,7 +2,7 @@
import marimo
-__generated_with = "0.3.12"
+__generated_with = "0.8.0"
app = marimo.App()
@@ -24,9 +24,7 @@ def __(alt, source):
scale=alt.Scale(domain=[0, 360], scheme="rainbow"),
legend=None,
),
- angle=alt.Angle(
- "dir", scale=alt.Scale(domain=[0, 360], range=[180, 540])
- ),
+ angle=alt.Angle("dir", scale=alt.Scale(domain=[0, 360], range=[180, 540])),
size=alt.Size("speed", scale=alt.Scale(rangeMax=500)),
).project("equalEarth")
return
@@ -58,11 +56,11 @@ def __(alt, cars, mo):
@app.cell
-def __(alt, datum, stocks):
+def __(alt, stocks):
base = (
alt.Chart(stocks)
.encode(x="date:T", y="price:Q", color="symbol:N")
- .transform_filter(datum.symbol == "GOOG")
+ .transform_filter(alt.datum.symbol == "GOOG")
)
(base.mark_line() + base.mark_point())
@@ -78,9 +76,8 @@ def __():
@app.cell
def __():
import altair as alt
- from altair.expr import datum
from vega_datasets import data
- return alt, data, datum
+ return alt, data
if __name__ == "__main__":
diff --git a/marimo/_smoke_tests/third_party/holoviews_example.py b/marimo/_smoke_tests/third_party/holoviews_example.py
index 7972f7ec01..afebdb8c64 100644
--- a/marimo/_smoke_tests/third_party/holoviews_example.py
+++ b/marimo/_smoke_tests/third_party/holoviews_example.py
@@ -2,7 +2,7 @@
import marimo
-__generated_with = "0.3.4"
+__generated_with = "0.8.0"
app = marimo.App()
@@ -10,11 +10,11 @@ app = marimo.App()
def __(mo):
mo.md(
"""
- # HoloViews in marimo
- ```
- pip install holoviews
- ```
- """
+ # HoloViews in marimo
+ ```
+ pip install holoviews
+ ```
+ """
)
return
@@ -60,7 +60,7 @@ def __(backend, hv, mo, station_info):
@app.cell
def __(mo):
- mo.md("## Area chart")
+ mo.md("""## Area chart""")
return
@@ -73,7 +73,7 @@ def __(hv, np):
@app.cell
def __(mo):
- mo.md("## Scatter chart")
+ mo.md("""## Scatter chart""")
return
@@ -85,7 +85,7 @@ def __(scatter):
@app.cell
def __(mo):
- mo.md("# HV Plot")
+ mo.md("""# HV Plot""")
return
@@ -100,7 +100,7 @@ def __():
@app.cell
def __(mo):
- mo.md("# Composed Views")
+ mo.md("""# Composed Views""")
return
@@ -109,8 +109,8 @@ def __():
import polars as pl
from hvplot import polars
- df3 = pl.DataFrame({"x": [1, 2, 3], "y": [1, 2, 3]})
- df4 = pl.DataFrame({"x": [1, 2, 3], "y": [3, 2.5, 3]})
+ df3 = pl.DataFrame({"x": [1, 2, 3], "y": [1, 2, 3]}, strict=False)
+ df4 = pl.DataFrame({"x": [1, 2, 3], "y": [3, 2.5, 3]}, strict=False)
return df3, df4, pl, polars
diff --git a/tests/_smoke_tests/config.yml b/tests/_smoke_tests/config.yml
index 853b9c340e..9f18ca08f3 100644
--- a/tests/_smoke_tests/config.yml
+++ b/tests/_smoke_tests/config.yml
@@ -2,42 +2,81 @@ files:
###################
# Inputs
ansi.py:
- input: "y"
+ input: 'y'
stdin.py:
- input: "y"
+ input: 'y'
###################
- # Errors
- bugs/924.py:
- failed_reason: "ModuleNotFoundError: No module named 'micropip'"
- third_party/ipython_display.py:
- failed_reason: "ModuleNotFoundError: No module named 'tikz'"
+ # Expected Errors
+ anywidget/tldraw_colorpicker.py:
+ failed_reason: "ModuleNotFoundError: No module named 'tldraw'"
bugs/1055.py:
failed_reason: "ModuleNotFoundError: No module named 'manim_slides'"
bugs/1270.py:
- failed_reason: "UDF failed: DataFrame constructor"
- stop.py:
- failed_reason: "MarimoStopError"
+ failed_reason: 'UDF failed: DataFrame constructor'
+ bugs/924.py:
+ failed_reason: "ModuleNotFoundError: No module named 'micropip'"
+ bugs/1851.py:
+ failed_reason: 'ValueError: 0'
+ bugs/1710.py:
+ failed_reason: "No module named 'keras'"
charts/1mil_flights.py:
- failed_reason: "MarimoStopError"
+ failed_reason: MaxRowsError
errors.py:
- failed_reason: "UnparsableError"
- reactive_plots.py:
- failed_reason: "MarimoStopError"
+ failed_reason: UnparsableError
model_comparison/model_comparison.py:
- failed_reason: "MarimoStopError"
+ failed_reason: MarimoStopError
+ no_mutating.py:
+ failed_reason:
+ - Setting the value of a UIElement is not allowed
+ - Setting the on_change handler of a UIElement is not allowed
+ - "AttributeError: 'text' object has no attribute 'on_change'"
+ reactive_plots.py:
+ failed_reason: MarimoStopError
+ stop.py:
+ failed_reason: MarimoStopError
third_party/duckdb_example.py:
- failed_reason: "MarimoStopError"
+ failed_reason: MarimoStopError
+ third_party/ipython_display.py:
+ failed_reason: "ModuleNotFoundError: No module named 'tikz'"
- ###################
+ ########################################
# Not a marimo app
custom_server/my_server.py:
skip: true
+ # Network requests
+ sql/motherduck.py:
+ skip: true
+ # Network requests
+ sql/limits.py:
+ skip: true
+ # Network requests
+ sql/electric_vehicles.py:
+ skip: true
+ # Network requests
+ sql/sqlite.py:
+ skip: true
+ # Network requests
+ sql.py:
+ skip: true
+ # This runs plt.show() which blocks the test
+ bugs/1510.py:
+ skip: true
# This runs plt.show() which blocks the test
bugs/1086.py:
skip: true
+ # Network requests
ws.py:
skip: true
+ # Login
+ integrations/google_cloud_bigquery.py:
+ skip: true
+ # Login
+ integrations/google_cloud_storage.py:
+ skip: true
+ # Login
+ integrations/google_sheets.py:
+ skip: true
embeddings/debugging_embeddings.py:
skip: true
embeddings/embedding_numbers.py:
@@ -66,9 +105,19 @@ files:
# Should be fixed
refresh.py: # flaky
skip: true
- failed_reason: "MarimoStopError"
+ failed_reason: 'MarimoStopError'
iplot.py:
skip: true
- failed_reason: "RuntimeError: cannot schedule new futures after interpreter shutdown"
+ failed_reason: 'RuntimeError: cannot schedule new futures after interpreter shutdown'
pdb_test.py:
failed_reason: "AttributeError: module 'marimo' has no attribute 'pdb'"
+ import_named_cells.py:
+ failed_reason: "TypeError: unhashable type: 'text'"
+ appcomp/double_nested/main.py:
+ failed_reason: 'RuntimeError: asyncio.run() cannot be called from a running event loop'
+ third_party/holoviews_example.py: # bad import
+ skip: true
+ bugs/1351.py: # bad import
+ skip: true
+ bugs/1072.py: # bad import
+ skip: true
diff --git a/tests/_smoke_tests/run_all.py b/tests/_smoke_tests/run_all.py
index fa9e908179..c28a6160e2 100644
--- a/tests/_smoke_tests/run_all.py
+++ b/tests/_smoke_tests/run_all.py
@@ -65,7 +65,9 @@ async def _run_test(
if skip is True:
return
- failed_reason = file_config.get("failed_reason", None)
+ failed_reason: str | list[str] | None = file_config.get(
+ "failed_reason", None
+ )
input_data = file_config.get("input", None)
with open(file, "r") as f: # noqa: ASYNC101 ASYNC230
@@ -74,7 +76,7 @@ async def _run_test(
return
process, stdout, stderr = await Cmd(
- f"python {file}", timeout=10, input_data=input_data
+ f"python {file}", timeout=15, input_data=input_data
).run()
if failed_reason:
@@ -82,7 +84,12 @@ async def _run_test(
assert (
process.returncode != 0
), f"{relative_file} Expected error: {failed_reason}"
- assert failed_reason in stderr, f"File: {file}"
+ if isinstance(failed_reason, list):
+ assert any(
+ reason in stderr for reason in failed_reason
+ ), f"File: {file}. Expected error one of {failed_reason} in {stderr}" # noqa: E501
+ else:
+ assert failed_reason in stderr, f"File: {file}"
# Allow MarimoStop
elif "MarimoStop" in stderr:
assert (