Skip to content

Commit 837dfee

Browse files
authored
feat: add marimo notebooks (#37)
* feat: add marimo notebooks This PR adds marimo notebook versions of the .ipynb files in the `./marimo` directory, and adds URLs to `README.md` to launch those notebooks in molab. The URLs currently refer to the author's repo (`gvwilson`) and this branch (`adding-marimo-notebooks`) so that the PR can be tested. Those URLs will have to be adjusted to make this work on `main` before the PR is merged. Note that these notebooks load datasets from URLs rather than from `altair.datasets` so that the same notebooks can be used via WASM (which can't load `altair.datasets` because of Pyodide/C-package issues). * update links * feat: add workflow to run marimo notebooks
1 parent 471ed58 commit 837dfee

11 files changed

Lines changed: 6089 additions & 12 deletions

.github/workflows/run-marimo.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: run-marimo
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
run:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v4
18+
with:
19+
python-version: '3.13'
20+
21+
- name: Install dependencies
22+
run: |
23+
uv sync
24+
uv pip install marimo
25+
26+
- name: Run marimo notebooks
27+
run: |
28+
for f in marimo/0[1-7]_*.py; do
29+
echo "Running $f"
30+
uv run marimo export html --sandbox "$f" -o /dev/null
31+
done
32+
33+
- name: Run debugging notebook (deliberately contains errors)
34+
run: uv run marimo export html --sandbox marimo/08_debugging.py -o /dev/null || true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.ipynb_checkpoints
2+
__marimo__
23
*~

README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Data Visualization Curriculum
22

3-
A data visualization curriculum of interactive notebooks, using [Vega-Lite](https://vega.github.io/vega-lite/) and [Altair](https://altair-viz.github.io/). This repository contains a series of **Python**-based Jupyter notebooks. The notebooks are online in a [Jupyter book](https://uwdata.github.io/visualization-curriculum/intro.html), runnable locally or online on [Colab](https://colab.research.google.com/github/uwdata/visualization-curriculum), [Nextjournal](https://github.nextjournal.com/uwdata/visualization-curriculum), or [Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_introduction.ipynb). A corresponding set of **JavaScript** notebooks are available online on [Observable](https://observablehq.com/@uwdata/data-visualization-curriculum).
3+
A data visualization curriculum of interactive notebooks, using [Vega-Lite](https://vega.github.io/vega-lite/) and [Altair](https://altair-viz.github.io/). This repository contains a series of **Python** notebooks using [Jupyter](https://jupyter.org/) and [marimo](https://marimo.io/). The notebooks are online in a [Jupyter book](https://uwdata.github.io/visualization-curriculum/intro.html), runnable locally or online on [Colab](https://colab.research.google.com/github/uwdata/visualization-curriculum), [Nextjournal](https://github.nextjournal.com/uwdata/visualization-curriculum), [Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_introduction.ipynb), or [molab](https://marimo.io/for-learners#learn-altair). A corresponding set of **JavaScript** notebooks are available online on [Observable](https://observablehq.com/@uwdata/data-visualization-curriculum).
44

55
## Curriculum
66

@@ -13,7 +13,8 @@ A data visualization curriculum of interactive notebooks, using [Vega-Lite](http
1313
[Colab](https://colab.research.google.com/github/uwdata/visualization-curriculum/blob/master/altair_introduction.ipynb) |
1414
[Nextjournal](https://github.nextjournal.com/uwdata/visualization-curriculum/blob/master/altair_introduction.ipynb) |
1515
[Observable](https://observablehq.com/@uwdata/introduction-to-vega-lite) |
16-
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_introduction.ipynb)
16+
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_introduction.ipynb) |
17+
[Marimo](https://molab.marimo.io/github/uwdata/visualization-curriculum/blob/main/marimo/01_introduction.py)
1718
</small>
1819

1920
2. Data Types, Graphical Marks, and Visual Encoding Channels<br/>
@@ -23,7 +24,8 @@ A data visualization curriculum of interactive notebooks, using [Vega-Lite](http
2324
[Colab](https://colab.research.google.com/github/uwdata/visualization-curriculum/blob/master/altair_marks_encoding.ipynb) |
2425
[Nextjournal](https://github.nextjournal.com/uwdata/visualization-curriculum/blob/master/altair_marks_encoding.ipynb) |
2526
[Observable](https://observablehq.com/@uwdata/data-types-graphical-marks-and-visual-encoding-channels) |
26-
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_marks_encoding.ipynb)
27+
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_marks_encoding.ipynb) |
28+
[Marimo](https://molab.marimo.io/github/uwdata/visualization-curriculum/blob/main/marimo/02_marks_encoding.py)
2729
</small>
2830

2931
3. Data Transformation<br/>
@@ -33,7 +35,8 @@ A data visualization curriculum of interactive notebooks, using [Vega-Lite](http
3335
[Colab](https://colab.research.google.com/github/uwdata/visualization-curriculum/blob/master/altair_data_transformation.ipynb) |
3436
[Nextjournal](https://github.nextjournal.com/uwdata/visualization-curriculum/blob/master/altair_data_transformation.ipynb) |
3537
[Observable](https://observablehq.com/@uwdata/data-transformation) |
36-
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_data_transformation.ipynb)
38+
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_data_transformation.ipynb) |
39+
[Marimo](https://molab.marimo.io/github/uwdata/visualization-curriculum/blob/main/marimo/03_data_transformation.py)
3740
</small>
3841

3942
4. Scales, Axes, and Legends<br/>
@@ -43,7 +46,8 @@ A data visualization curriculum of interactive notebooks, using [Vega-Lite](http
4346
[Colab](https://colab.research.google.com/github/uwdata/visualization-curriculum/blob/master/altair_scales_axes_legends.ipynb) |
4447
[Nextjournal](https://github.nextjournal.com/uwdata/visualization-curriculum/blob/master/altair_scales_axes_legends.ipynb) |
4548
[Observable](https://observablehq.com/@uwdata/scales-axes-and-legends) |
46-
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_scales_axes_legends.ipynb)
49+
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_scales_axes_legends.ipynb) |
50+
[Marimo](https://molab.marimo.io/github/uwdata/visualization-curriculum/blob/main/marimo/04_scales_axes_legends.py)
4751
</small>
4852

4953
5. Multi-View Composition<br/>
@@ -53,7 +57,8 @@ A data visualization curriculum of interactive notebooks, using [Vega-Lite](http
5357
[Colab](https://colab.research.google.com/github/uwdata/visualization-curriculum/blob/master/altair_view_composition.ipynb) |
5458
[Nextjournal](https://github.nextjournal.com/uwdata/visualization-curriculum/blob/master/altair_view_composition.ipynb) |
5559
[Observable](https://observablehq.com/@uwdata/multi-view-composition) |
56-
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_view_composition.ipynb)
60+
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_view_composition.ipynb) |
61+
[Marimo](https://molab.marimo.io/github/uwdata/visualization-curriculum/blob/main/marimo/05_view_composition.py)
5762
</small>
5863

5964
6. Interaction<br/>
@@ -63,7 +68,8 @@ A data visualization curriculum of interactive notebooks, using [Vega-Lite](http
6368
[Colab](https://colab.research.google.com/github/uwdata/visualization-curriculum/blob/master/altair_interaction.ipynb) |
6469
[Nextjournal](https://github.nextjournal.com/uwdata/visualization-curriculum/blob/master/altair_interaction.ipynb) |
6570
[Observable](https://observablehq.com/@uwdata/interaction) |
66-
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_interaction.ipynb)
71+
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_interaction.ipynb) |
72+
[Marimo](https://molab.marimo.io/github/uwdata/visualization-curriculum/blob/main/marimo/06_interaction.py)
6773
</small>
6874

6975
7. Cartographic Visualization<br/>
@@ -73,7 +79,8 @@ A data visualization curriculum of interactive notebooks, using [Vega-Lite](http
7379
[Colab](https://colab.research.google.com/github/uwdata/visualization-curriculum/blob/master/altair_cartographic.ipynb) |
7480
[Nextjournal](https://github.nextjournal.com/uwdata/visualization-curriculum/blob/master/altair_cartographic.ipynb) |
7581
[Observable](https://observablehq.com/@uwdata/cartographic-visualization) |
76-
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_cartographic.ipynb)
82+
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_cartographic.ipynb) |
83+
[Marimo](https://molab.marimo.io/github/uwdata/visualization-curriculum/blob/main/marimo/07_cartographic.py)
7784
</small>
7885

7986
### Support
@@ -84,7 +91,8 @@ A data visualization curriculum of interactive notebooks, using [Vega-Lite](http
8491
[Jupyter](https://github.com/uwdata/visualization-curriculum/blob/master/altair_debugging.ipynb) |
8592
[Colab](https://colab.research.google.com/github/uwdata/visualization-curriculum/blob/master/altair_debugging.ipynb) |
8693
[Nextjournal](https://github.nextjournal.com/uwdata/visualization-curriculum/blob/master/altair_debugging.ipynb) |
87-
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_debugging.ipynb)
94+
[Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_debugging.ipynb) |
95+
[Marimo](https://molab.marimo.io/github/uwdata/visualization-curriculum/blob/main/marimo/08_debugging.py)
8896
</small>
8997

9098
## Getting Started
@@ -94,14 +102,16 @@ The visualization curriculum can be used either online or on your local computer
94102
### Online
95103

96104
- [Jupyter Book](https://uwdata.github.io/visualization-curriculum/) to read Python notebooks online.
97-
- Run the **Python** notebooks online on [Colab](https://colab.research.google.com/github/uwdata/visualization-curriculum/), [Nextjournal](https://github.nextjournal.com/uwdata/visualization-curriculum/), or [Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_introduction.ipynb)
98-
- Run the **JavaScript** notebooks online using [Observable](https://observablehq.com/collection/@uwdata/visualization-curriculum)
105+
- Run the **Python** notebooks online on [Colab](https://colab.research.google.com/github/uwdata/visualization-curriculum/), [Nextjournal](https://github.nextjournal.com/uwdata/visualization-curriculum/), or [Deepnote](https://deepnote.com/launch?url=https://github.com/uwdata/visualization-curriculum/blob/master/altair_introduction.ipynb).
106+
- Run the **JavaScript** notebooks online using [Observable](https://observablehq.com/collection/@uwdata/visualization-curriculum).
107+
- Run the **marimo** notebooks online using [molab](https://marimo.io/for-learners#learn-altair).
99108

100109
### Local Installation
101110

102111
1. [Install Altair and a notebook environment](https://altair-viz.github.io/getting_started/installation.html). The most recent versions of these notebooks use _Altair version 6_.
103112
2. Download the notebooks from the [releases page](https://github.com/uwdata/visualization-curriculum/releases). Typically you will want to use the most recent release.
104-
3. Open the notebooks in your local notebook environment. For example, if you have JupyterLab installed (v1.0 or higher is required), run `jupyter lab` within the directory containing the notebooks. With [uv](https://docs.astral.sh/uv/guides/install-python/), you can run `uv run jupyter lab` (it automatically installs the dependencies).
113+
3. If you are using [Jupyter](https://jupyter.org/), open the `.ipynb` notebooks in your local notebook environment. For example, if you have JupyterLab installed (v1.0 or higher is required), run `jupyter lab` within the directory containing the notebooks. With [uv](https://docs.astral.sh/uv/guides/install-python/), you can run `uv run jupyter lab` (it automatically installs the dependencies).
114+
4. If you are using [marimo](https://marimo.io/), open the `.py` notebooks in the `marimo` directory using either `marimo run marimo/notebook.py` (to use the virtual environment you set up) or `uv run marimo run marimo/notebook.py` (to automatically install the dependencies in the notebook header).
105115

106116
Depending on your programming environment (and whether or not you have a live internet connection), you may want to specify a particular [renderer](https://altair-viz.github.io/user_guide/display_frontends.html) for Altair.
107117

0 commit comments

Comments
 (0)