Skip to content

Commit d82ee2d

Browse files
committed
Build slides in action
1 parent a2ba0d3 commit d82ee2d

File tree

8 files changed

+51
-128850
lines changed

8 files changed

+51
-128850
lines changed

.github/workflows/publish-slides.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ concurrency:
2121
cancel-in-progress: false
2222

2323
jobs:
24-
# Single deploy job since we're just deploying
25-
deploy:
26-
environment:
27-
name: github-pages
28-
url: ${{ steps.deployment.outputs.page_url }}
24+
build:
2925
runs-on: ubuntu-latest
3026
steps:
3127
- name: Checkout
3228
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3329
- name: Setup Pages
3430
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@a02a550bdd3185dba2ebb6aa98d77047ce54ad21 # v6.2.1
33+
- name: Build slides
34+
run: ./slides/generate_slides.sh regular
3535
- name: Package files
3636
run: |
3737
mkdir public && \
@@ -40,6 +40,14 @@ jobs:
4040
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
4141
with:
4242
path: public
43+
44+
deploy:
45+
environment:
46+
name: github-pages
47+
url: ${{ steps.deployment.outputs.page_url }}
48+
runs-on: ubuntu-latest
49+
needs: build
50+
steps:
4351
- name: Deploy to GitHub Pages
4452
id: deployment
4553
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,4 @@ dmypy.json
127127

128128
# misc.
129129
.DS_Store
130+
slides/html/

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ dependencies = [
2323
"hvplot==0.9.2",
2424
"panel==1.4.2",
2525
]
26+
27+
[dependency-groups]
28+
slides = [
29+
"nbmerge>=0.0.4",
30+
]

slides/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Workshop Slides
22

3-
This directory contains the notebooks used to generate the slides. The HTML version of the slides can be found in the [`html/`](./html/) directory. To generate a PDF version of the slides, use [this](https://stefaniemolin.com/python-data-viz-workshop/?print-pdf#/) link to view the slides (be patient – it takes a while to load), and then use `ctrl + P` or `cmd + P` to print to a PDF file.
3+
This directory contains the notebooks used to generate the slides. The slides themselves can be found at [`stefaniemolin.com/python-data-viz-workshop`](https://stefaniemolin.com/python-data-viz-workshop/). To generate a PDF version of the slides, use [this link instead](https://stefaniemolin.com/python-data-viz-workshop/?print-pdf#/) to view the slides (be patient – it takes a while to load), and then use `ctrl + P` or `cmd + P` to print to a PDF file.

slides/generate_slides.sh

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
#!/bin/bash
2-
3-
# setup
4-
VENV_NAME="data_viz_workshop"
1+
#!/usr/bin/env -S uv run --group slides bash
52

63
# get paths
74
SCRIPT=$(realpath "$0")
@@ -14,38 +11,22 @@ if [[ "$#" -ne 1 ]]; then
1411
else
1512
TEMPLATE_TYPE="$1";
1613

17-
# get venv status
18-
ACTIVE_ENV=$(basename $CONDA_DEFAULT_ENV)
19-
20-
if [[ "$CONDA_DEFAULT_ENV" == "" ]]; then
21-
echo "Virtual environment is not enabled. Quitting...";
22-
else
23-
if [[ "$CONDA_DEFAULT_ENV" != "$VENV_NAME" ]]; then
24-
echo "The $VENV_NAME conda env is not activated.";
25-
else
26-
# if nbmerge isn't installed, do so
27-
echo "Checking for nbmerge..."
28-
pip3 freeze | grep nbmerge || pip3 install nbmerge;
29-
30-
# use nbmerge to combine all slide notebooks into a single notebook
31-
echo "[nbmerge] Creating a combined notebook for all slides..."
32-
COMBINED_NOTEBOOK="$SLIDES_DIR/workshop.ipynb"
33-
nbmerge -o $COMBINED_NOTEBOOK $SLIDES_DIR/*.ipynb;
34-
35-
# make all slide decks
36-
jupyter nbconvert \
37-
--to slides \
38-
--template=$TEMPLATE_TYPE \
39-
--TemplateExporter.extra_template_basedirs="$SLIDES_DIR"/templates \
40-
--output-dir="$SLIDES_DIR"/html \
41-
"$COMBINED_NOTEBOOK";
14+
# use nbmerge to combine all slide notebooks into a single notebook
15+
echo "[nbmerge] Creating a combined notebook for all slides..."
16+
COMBINED_NOTEBOOK="$SLIDES_DIR/workshop.ipynb"
17+
nbmerge -o $COMBINED_NOTEBOOK $SLIDES_DIR/*.ipynb;
4218

43-
# delete the combined notebook
44-
echo "Cleaning up..."
45-
rm $COMBINED_NOTEBOOK
19+
# make all slide decks
20+
jupyter nbconvert \
21+
--to slides \
22+
--template=$TEMPLATE_TYPE \
23+
--TemplateExporter.extra_template_basedirs="$SLIDES_DIR"/templates \
24+
--output-dir="$SLIDES_DIR"/html \
25+
"$COMBINED_NOTEBOOK";
4626

47-
echo "Done!";
48-
fi
49-
fi
27+
# delete the combined notebook
28+
echo "Cleaning up..."
29+
rm $COMBINED_NOTEBOOK
5030

31+
echo "Done!";
5132
fi

slides/html/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)