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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
smoke-test: plotly resampler (#4096)
Myles Scolnickbc976f9fea91
diff --git a/marimo/_smoke_tests/plotly/_plotly_resampler.py b/marimo/_smoke_tests/plotly/_plotly_resampler.pynew file mode 100644index 0000000000..e23365b997--- /dev/null+++ b/marimo/_smoke_tests/plotly/_plotly_resampler.py@@ -0,0 +1,53 @@+# /// script+# requires-python = ">=3.12"+# dependencies = [+# "ipywidgets==8.1.5",+# "numpy==2.2.3",+# "pandas==2.2.3",+# "plotly==5.24.1",+# "plotly-resampler==0.10.0",+# ]+# ///++import marimo++__generated_with = "0.11.19"+app = marimo.App(width="medium")+++def _():+ import numpy as np+ import pandas as pd+ import plotly.express as px+ import ipywidgets+ from plotly_resampler import register_plotly_resampler++ # Register the resampler (using widget mode for interactive performance)+ register_plotly_resampler(mode="widget")++ # Generate 1 million data points+ n_points = 1_000_000+ np.random.seed(42) # for reproducibility++ # Create a DataFrame with x, y, and color columns+ df = pd.DataFrame(+ {+ "x": np.linspace(0, 100, n_points),+ "y": np.sin(np.linspace(0, 100, n_points))+ + np.random.normal(0, 0.5, n_points),+ "color": np.random.choice(["A", "B", "C"], n_points),+ }+ )++ # Create a scatter plot with Plotly Express+ fig = px.scatter(+ df, x="x", y="y", color="color", title="Scatter Plot with 1M Datapoints"+ )++ fig+ return df, fig, ipywidgets, n_points, np, pd, px, register_plotly_resampler+++if __name__ == "__main__":+ app.run()diff --git a/marimo/_smoke_tests/plotly/_plotly_resampler_0_11.py b/marimo/_smoke_tests/plotly/_plotly_resampler_0_11.pynew file mode 100644index 0000000000..169714e49f--- /dev/null+++ b/marimo/_smoke_tests/plotly/_plotly_resampler_0_11.py@@ -0,0 +1,55 @@+# /// script+# requires-python = ">=3.12"+# dependencies = [+# "anywidget==0.9.15",+# "ipywidgets==8.1.5",+# "marimo",+# "numpy==2.2.3",+# "pandas==2.2.3",+# "plotly==6.0.0",+# "plotly-resampler==0.11.0rc0",+# ]+# ///++import marimo++__generated_with = "0.11.19"+app = marimo.App(width="medium")+++def _():+ import numpy as np+ import pandas as pd+ import plotly.express as px+ import anywidget+ from plotly_resampler import register_plotly_resampler++ # Register the resampler (using widget mode for interactive performance)+ register_plotly_resampler(mode="widget")++ # Generate 1 million data points+ n_points = 1_000_000+ np.random.seed(42) # for reproducibility++ # Create a DataFrame with x, y, and color columns+ df = pd.DataFrame(+ {+ "x": np.linspace(0, 100, n_points),+ "y": np.sin(np.linspace(0, 100, n_points))+ + np.random.normal(0, 0.5, n_points),+ "color": np.random.choice(["A", "B", "C"], n_points),+ }+ )++ # Create a scatter plot with Plotly Express+ fig = px.scatter(+ df, x="x", y="y", color="color", title="Scatter Plot with 1M Datapoints"+ )++ fig+ return anywidget, df, fig, n_points, np, pd, px, register_plotly_resampler+++if __name__ == "__main__":+ app.run()