Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions .github/workflows/publish-slides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ concurrency:
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
- name: Install uv
uses: astral-sh/setup-uv@a02a550bdd3185dba2ebb6aa98d77047ce54ad21 # v6.2.1
- name: Build slides
run: ./slides/generate_slides.sh regular
- name: Package files
run: |
mkdir public && \
Expand All @@ -40,6 +40,14 @@ jobs:
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: public

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,4 @@ dmypy.json

# misc.
.DS_Store
slides/html/
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ dependencies = [
"hvplot==0.9.2",
"panel==1.4.2",
]

[dependency-groups]
slides = [
"nbmerge>=0.0.4",
]
2 changes: 1 addition & 1 deletion slides/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Workshop Slides

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.
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.
51 changes: 16 additions & 35 deletions slides/generate_slides.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/bin/bash

# setup
VENV_NAME="data_viz_workshop"
#!/usr/bin/env -S uv run --group slides bash

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

# get venv status
ACTIVE_ENV=$(basename $CONDA_DEFAULT_ENV)

if [[ "$CONDA_DEFAULT_ENV" == "" ]]; then
echo "Virtual environment is not enabled. Quitting...";
else
if [[ "$CONDA_DEFAULT_ENV" != "$VENV_NAME" ]]; then
echo "The $VENV_NAME conda env is not activated.";
else
# if nbmerge isn't installed, do so
echo "Checking for nbmerge..."
pip3 freeze | grep nbmerge || pip3 install nbmerge;

# use nbmerge to combine all slide notebooks into a single notebook
echo "[nbmerge] Creating a combined notebook for all slides..."
COMBINED_NOTEBOOK="$SLIDES_DIR/workshop.ipynb"
nbmerge -o $COMBINED_NOTEBOOK $SLIDES_DIR/*.ipynb;

# make all slide decks
jupyter nbconvert \
--to slides \
--template=$TEMPLATE_TYPE \
--TemplateExporter.extra_template_basedirs="$SLIDES_DIR"/templates \
--output-dir="$SLIDES_DIR"/html \
"$COMBINED_NOTEBOOK";
# use nbmerge to combine all slide notebooks into a single notebook
echo "[nbmerge] Creating a combined notebook for all slides..."
COMBINED_NOTEBOOK="$SLIDES_DIR/workshop.ipynb"
nbmerge -o $COMBINED_NOTEBOOK $SLIDES_DIR/*.ipynb;

# delete the combined notebook
echo "Cleaning up..."
rm $COMBINED_NOTEBOOK
# make all slide decks
jupyter nbconvert \
--to slides \
--template=$TEMPLATE_TYPE \
--TemplateExporter.extra_template_basedirs="$SLIDES_DIR"/templates \
--output-dir="$SLIDES_DIR"/html \
"$COMBINED_NOTEBOOK";

echo "Done!";
fi
fi
# delete the combined notebook
echo "Cleaning up..."
rm $COMBINED_NOTEBOOK

echo "Done!";
fi
3 changes: 0 additions & 3 deletions slides/html/README.md

This file was deleted.

Loading
Loading