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
chore: reorganize examples (#2162)
Akshay Agrawale93956254b54
diff --git a/.gitignore b/.gitignoreindex a309e21596..631f791898 100644--- a/.gitignore+++ b/.gitignore@@ -4,6 +4,7 @@*.txt# Byte-compiled / optimized / DLL files+__pycache____pycache__/*.py[cod]*$py.classdiff --git a/examples/model_comparison/model_comparison.py b/examples/ai/model_comparison/model_comparison.pysimilarity index 100%rename from examples/model_comparison/model_comparison.pyrename to examples/ai/model_comparison/model_comparison.pydiff --git a/examples/integrations/google_cloud_bigquery.py b/examples/google/google_cloud_bigquery.pysimilarity index 100%rename from examples/integrations/google_cloud_bigquery.pyrename to examples/google/google_cloud_bigquery.pydiff --git a/examples/integrations/google_cloud_storage.py b/examples/google/google_cloud_storage.pysimilarity index 100%rename from examples/integrations/google_cloud_storage.pyrename to examples/google/google_cloud_storage.pydiff --git a/examples/integrations/google_sheets.py b/examples/google/google_sheets.pysimilarity index 100%rename from examples/integrations/google_sheets.pyrename to examples/google/google_sheets.pydiff --git a/examples/arrays_and_dicts.py b/examples/marimo/arrays_and_dicts.pysimilarity index 100%rename from examples/arrays_and_dicts.pyrename to examples/marimo/arrays_and_dicts.pydiff --git a/examples/batch_and_form.py b/examples/marimo/batch_and_form.pysimilarity index 100%rename from examples/batch_and_form.pyrename to examples/marimo/batch_and_form.pydiff --git a/examples/character_count.py b/examples/marimo/character_count.pysimilarity index 100%rename from examples/character_count.pyrename to examples/marimo/character_count.pydiff --git a/examples/data_explorer.py b/examples/marimo/data_explorer.pysimilarity index 100%rename from examples/data_explorer.pyrename to examples/marimo/data_explorer.pydiff --git a/examples/layout.py b/examples/marimo/layout.pysimilarity index 100%rename from examples/layout.pyrename to examples/marimo/layout.pydiff --git a/examples/third_party/mermaid.py b/examples/marimo/mermaid.pysimilarity index 100%rename from examples/third_party/mermaid.pyrename to examples/marimo/mermaid.pydiff --git a/examples/reactive_plots.py b/examples/marimo/reactive_plots.pysimilarity index 100%rename from examples/reactive_plots.pyrename to examples/marimo/reactive_plots.pydiff --git a/examples/refresh.py b/examples/marimo/refresh.pysimilarity index 100%rename from examples/refresh.pyrename to examples/marimo/refresh.pydiff --git a/examples/table.py b/examples/marimo/table.pysimilarity index 100%rename from examples/table.pyrename to examples/marimo/table.pydiff --git a/examples/tabs.py b/examples/marimo/tabs.pysimilarity index 100%rename from examples/tabs.pyrename to examples/marimo/tabs.pydiff --git a/examples/task_list.py b/examples/marimo/task_list.pysimilarity index 100%rename from examples/task_list.pyrename to examples/marimo/task_list.pydiff --git a/examples/sine_wave.py b/examples/sine_wave.pydeleted file mode 100644index 499e1ac79b..0000000000--- a/examples/sine_wave.py+++ /dev/null@@ -1,63 +0,0 @@-import marimo--__generated_with = "0.1.0"-app = marimo.App()---def __(mo):- mo.md("# Plotting a Sine Wave")- return---def __(mo, np):- period = mo.ui.slider(start=np.pi, stop=2*np.pi, label="period")- amplitude = mo.ui.slider(start=1, stop=2, step=0.1, label="amplitude")-- [period, amplitude]- return amplitude, period---def __(amplitude, mo, period):- mo.md(- rf"""- Here's a plot of- $f(x) = {amplitude.value:.02f}\sin((2\pi/{period.value:.02f}) x)$:- """- )- return---def __(amplitude, period, plot_sine_wave):- plot_sine_wave(period.value, amplitude.value)- return---def __(np, plt):- def plot_sine_wave(period, amplitude):- x = np.linspace(0, 2*np.pi, num=100)- plt.figure(figsize=(6.7, 2.5))- plt.plot(x, amplitude*np.sin(x*2*np.pi / period))- plt.xlabel('$x$')- plt.xlim(0, 2*np.pi)- plt.ylim(-2, 2)- plt.tight_layout()- return plt.gca()- return plot_sine_wave,---def __():- import marimo as mo-- import numpy as np- import matplotlib.pyplot as plt- return mo, np, plt---if __name__ == "__main__":- app.run()diff --git a/examples/anywidget/reactive_quak.py b/examples/third_party/anywidget/reactive_quak.pysimilarity index 85%rename from examples/anywidget/reactive_quak.pyrename to examples/third_party/anywidget/reactive_quak.pyindex b7694596dc..a5c8f48d91 100644--- a/examples/anywidget/reactive_quak.py+++ b/examples/third_party/anywidget/reactive_quak.py@@ -1,6 +1,17 @@+# /// script+# requires-python = ">=3.12"+# dependencies = [+# "altair",+# "polars",+# "marimo",+# "quak",+# "pandas",+# ]+# ///+import marimo-__generated_with = "0.7.13"+__generated_with = "0.8.2"app = marimo.App(width="medium")@@ -20,7 +31,7 @@ def __(mo, pl, quak):return df, widget[email protected](hide_code=True)def __(grouped_selection, mo):import altair as alt@@ -48,7 +59,6 @@ def __(widget):def __(selection):selection["count"] = 1grouped_selection = selection[["nationality", "count"]].groupby(["nationality"]).agg("count").reset_index()- grouped_selectionreturn grouped_selection,diff --git a/examples/anywidget/tldraw_colorpicker.py b/examples/third_party/anywidget/tldraw_colorpicker.pysimilarity index 100%rename from examples/anywidget/tldraw_colorpicker.pyrename to examples/third_party/anywidget/tldraw_colorpicker.pydiff --git a/examples/optimization/regularization_and_sparsity.py b/examples/third_party/cvxpy/regularization_and_sparsity.pysimilarity index 100%rename from examples/optimization/regularization_and_sparsity.pyrename to examples/third_party/cvxpy/regularization_and_sparsity.pydiff --git a/examples/optimization/signals/app.py b/examples/third_party/cvxpy/signals/app.pysimilarity index 100%rename from examples/optimization/signals/app.pyrename to examples/third_party/cvxpy/signals/app.pydiff --git a/examples/optimization/signals/assets/solar_power_soiling_reference.png b/examples/third_party/cvxpy/signals/assets/solar_power_soiling_reference.pngsimilarity index 100%rename from examples/optimization/signals/assets/solar_power_soiling_reference.pngrename to examples/third_party/cvxpy/signals/assets/solar_power_soiling_reference.pngdiff --git a/examples/optimization/signals/examples.py b/examples/third_party/cvxpy/signals/examples.pysimilarity index 100%rename from examples/optimization/signals/examples.pyrename to examples/third_party/cvxpy/signals/examples.pydiff --git a/examples/optimization/signals/modules/__init__.py b/examples/third_party/cvxpy/signals/modules/__init__.pysimilarity index 100%rename from examples/optimization/signals/modules/__init__.pyrename to examples/third_party/cvxpy/signals/modules/__init__.pydiff --git a/examples/optimization/signals/modules/components.py b/examples/third_party/cvxpy/signals/modules/components.pysimilarity index 100%rename from examples/optimization/signals/modules/components.pyrename to examples/third_party/cvxpy/signals/modules/components.pydiff --git a/examples/optimization/signals/modules/dataloaders.py b/examples/third_party/cvxpy/signals/modules/dataloaders.pysimilarity index 100%rename from examples/optimization/signals/modules/dataloaders.pyrename to examples/third_party/cvxpy/signals/modules/dataloaders.pydiff --git a/examples/optimization/signals/modules/explainer.py b/examples/third_party/cvxpy/signals/modules/explainer.pysimilarity index 100%rename from examples/optimization/signals/modules/explainer.pyrename to examples/third_party/cvxpy/signals/modules/explainer.pydiff --git a/examples/optimization/signals/modules/intro_problem.py b/examples/third_party/cvxpy/signals/modules/intro_problem.pysimilarity index 100%rename from examples/optimization/signals/modules/intro_problem.pyrename to examples/third_party/cvxpy/signals/modules/intro_problem.pydiff --git a/examples/optimization/signals/modules/layout.py b/examples/third_party/cvxpy/signals/modules/layout.pysimilarity index 100%rename from examples/optimization/signals/modules/layout.pyrename to examples/third_party/cvxpy/signals/modules/layout.pydiff --git a/examples/optimization/signals/modules/problems.py b/examples/third_party/cvxpy/signals/modules/problems.pysimilarity index 100%rename from examples/optimization/signals/modules/problems.pyrename to examples/third_party/cvxpy/signals/modules/problems.pydiff --git a/examples/optimization/signals/modules/solutions.py b/examples/third_party/cvxpy/signals/modules/solutions.pysimilarity index 100%rename from examples/optimization/signals/modules/solutions.pyrename to examples/third_party/cvxpy/signals/modules/solutions.pydiff --git a/examples/optimization/smallest_enclosing_circle.py b/examples/third_party/cvxpy/smallest_enclosing_circle.pysimilarity index 100%rename from examples/optimization/smallest_enclosing_circle.pyrename to examples/third_party/cvxpy/smallest_enclosing_circle.pydiff --git a/examples/third_party/duckdb_example.py b/examples/third_party/duckdb/duckdb_example.pysimilarity index 100%rename from examples/third_party/duckdb_example.pyrename to examples/third_party/duckdb/duckdb_example.pydiff --git a/examples/tables/coffee-sales.json b/examples/third_party/great_tables/coffee-sales.jsonsimilarity index 100%rename from examples/tables/coffee-sales.jsonrename to examples/third_party/great_tables/coffee-sales.jsondiff --git a/examples/tables/great_tables_example.py b/examples/third_party/great_tables/great_tables_example.pysimilarity index 100%rename from examples/tables/great_tables_example.pyrename to examples/third_party/great_tables/great_tables_example.pydiff --git a/examples/third_party/leafmap_example.py b/examples/third_party/leafmap/leafmap_example.pysimilarity index 100%rename from examples/third_party/leafmap_example.pyrename to examples/third_party/leafmap/leafmap_example.pydiff --git a/examples/geometry/mandelbrot.py b/examples/third_party/matplotlib/mandelbrot.pysimilarity index 100%rename from examples/geometry/mandelbrot.pyrename to examples/third_party/matplotlib/mandelbrot.pydiff --git a/examples/geometry/surfaces.py b/examples/third_party/matplotlib/surfaces.pysimilarity index 100%rename from examples/geometry/surfaces.pyrename to examples/third_party/matplotlib/surfaces.pydiff --git a/examples/third_party/plotly_image_selection.py b/examples/third_party/plotly/image_selection.pysimilarity index 100%rename from examples/third_party/plotly_image_selection.pyrename to examples/third_party/plotly/image_selection.pydiff --git a/examples/third_party/mapbox.py b/examples/third_party/plotly/mapbox.pysimilarity index 100%rename from examples/third_party/mapbox.pyrename to examples/third_party/plotly/mapbox.pydiff --git a/examples/third_party/polars_example.py b/examples/third_party/polars/polars_example.pysimilarity index 100%rename from examples/third_party/polars_example.pyrename to examples/third_party/polars/polars_example.pydiff --git a/examples/ai/substrate-run.py b/examples/third_party/substrate/video_generation.pysimilarity index 100%rename from examples/ai/substrate-run.pyrename to examples/third_party/substrate/video_generation.py