Skip to content

Commit 19d86b2

Browse files
committed
Use pyodide kernel in JupyterLite to deploy tutorial
1 parent 3ee527f commit 19d86b2

25 files changed

+123
-40
lines changed

.github/workflows/deploy.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build and deploy to github pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- '*'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
- name: Setup Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.13'
21+
- name: Install the dependencies
22+
run: |
23+
python -m pip install -r requirements.txt
24+
- name: Build the JupyterLite site
25+
run: |
26+
jupyter lite build --contents notebooks --output-dir dist
27+
- name: Upload artifact
28+
uses: actions/upload-pages-artifact@v3
29+
with:
30+
path: ./dist
31+
32+
deploy:
33+
needs: build
34+
if: github.ref == 'refs/heads/main'
35+
permissions:
36+
pages: write
37+
id-token: write
38+
39+
environment:
40+
name: github-pages
41+
url: ${{ steps.deployment.outputs.page_url }}
42+
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Deploy to GitHub Pages
46+
id: deployment
47+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,7 @@ dmypy.json
134134

135135
# Pyre type checker
136136
.pyre/
137+
138+
# JupyterLite deployment
139+
.jupyterlite.doit.db
140+
_output/

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# Work in progress to use pyodide kernel in JupyterLite for tutorial
2+
3+
Deployed to github pages at https://bokeh.github.io/tutorial
4+
5+
To try out locally, create a python virtual environment of your choice (`venv`, `pyenv`,
6+
'mamba', `conda`, etc) and follow these steps:
7+
8+
```bash
9+
python -m pip install -r requirements.txt
10+
jupyter lite build --contents notebooks
11+
jupyter lite serve
12+
```
13+
14+
and open a web browser at the URL specified.
15+
16+
------------------------
17+
18+
19+
120
# Bokeh tutorial notebooks
221

322
## Setup and run the tutorials

environment.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.
File renamed without changes.

notebooks/01_introduction.ipynb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@
127127
"metadata": {},
128128
"outputs": [],
129129
"source": [
130+
"%pip install -q geopandas\n",
131+
"\n",
130132
"# load and display tutorial dashboard\n",
131133
"from tutorial_dashboard import dashboard_layout\n",
132134
"\n",
@@ -245,7 +247,7 @@
245247
"Python script.\n",
246248
"This tutorial will reference the data preparation script but will not go into detail\n",
247249
"about the data preparation itself.\n",
248-
"You can find the data processing code in [`carriers_data.py`](../data/carriers_data.py).\n",
250+
"You can find the data processing code in [`carriers_data.py`](./data/carriers_data.py).\n",
249251
"\n",
250252
"This tutorial is designed to run on [mybinder.org](https://mybinder.readthedocs.io/en/latest/).\n",
251253
"You can also run this tutorial locally on your computer.\n",
@@ -286,7 +288,7 @@
286288
"source": [
287289
"# Next section\n",
288290
"\n",
289-
"<a href=\"02_installation_and_setup.ipynb\" target=\"_blank\">\n",
291+
"<a href=\"./02_installation_and_setup.ipynb\" target=\"_blank\">\n",
290292
" <img src=\"assets/arrow.svg\" alt=\"Next section\" width=\"100\" align=\"right\">\n",
291293
"</a>\n",
292294
"\n",

notebooks/02_installation_and_setup.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"source": [
118118
"# Next section\n",
119119
"\n",
120-
"<a href=\"03_basic_concepts.ipynb\" target=\"_blank\">\n",
120+
"<a href=\"./03_basic_concepts.ipynb\" target=\"_blank\">\n",
121121
" <img src=\"assets/arrow.svg\" alt=\"Next section\" width=\"100\" align=\"right\">\n",
122122
"</a>\n",
123123
"\n",

notebooks/03_basic_concepts.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@
256256
"source": [
257257
"# Next section\n",
258258
"\n",
259-
"<a href=\"04_basic_plots.ipynb\" target=\"_blank\">\n",
259+
"<a href=\"./04_basic_plots.ipynb\" target=\"_blank\">\n",
260260
" <img src=\"assets/arrow.svg\" alt=\"Next section\" width=\"100\" align=\"right\">\n",
261261
"</a>\n",
262262
"\n",

notebooks/04_basic_plots.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
"metadata": {},
3030
"outputs": [],
3131
"source": [
32+
"%pip install -q pandas\n",
33+
"\n",
3234
"# load tutorial data\n",
3335
"from tutorial_data import data"
3436
]
@@ -525,7 +527,7 @@
525527
"This is an example of how you can customize the appearance of the different\n",
526528
"elements of your plot.\n",
527529
"\n",
528-
"<a href=\"05_styling.ipynb\" target=\"_blank\">\n",
530+
"<a href=\"./05_styling.ipynb\" target=\"_blank\">\n",
529531
" <img src=\"assets/arrow.svg\" alt=\"Next section\" width=\"100\" align=\"right\">\n",
530532
"</a>\n",
531533
"\n",

notebooks/05_styling.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
"metadata": {},
3030
"outputs": [],
3131
"source": [
32+
"%pip install -q pandas\n",
33+
"\n",
3234
"# load tutorial data\n",
3335
"from tutorial_data import data"
3436
]
@@ -749,7 +751,7 @@
749751
"source": [
750752
"# Next section\n",
751753
"\n",
752-
"<a href=\"06_data_sources.ipynb\" target=\"_blank\">\n",
754+
"<a href=\"./06_data_sources.ipynb\" target=\"_blank\">\n",
753755
" <img src=\"assets/arrow.svg\" alt=\"Next section\" width=\"100\" align=\"right\">\n",
754756
"</a>\n",
755757
"\n",

0 commit comments

Comments
 (0)