Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (56 loc) · 2.23 KB
/
Copy pathMakefile
File metadata and controls
75 lines (56 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
lab:
jupyter lab
notebook:
jupyter notebook
linkcheck:
ruby ./extras/scripts/broken_links.rb
slides:
jupyter nbconvert --to slides \
--SlidesExporter.reveal_scroll=True \
--post serve lecture_$(lec).ipynb
test:
pytest
# overridden in update.sh
file := .
format:
ruff format $(file)
# the URL the site will be served from, e.g. https://python-public-policy.afeld.me/en/columbia/
site_url :=
site:
$(if $(site_url),,$(error site_url is required))
jupyter-book build --html --ci --strict
# these point to the temporary server used for the build (http://localhost:3000), so let Read the Docs generate them instead
rm -f _build/html/robots.txt _build/html/sitemap.xml _build/html/sitemap_style.xsl
# generate redirects from old Jupyter Book 1 URLs. The script only needs its own dependencies, so skip installing the project's.
uv run --no-project --with click --with pyyaml \
https://github.com/raw/jupyter-book/jb1-redirect-generator/d70ce6d7df9f2dfc83bb1d409336c0cc3e20697f/generate_redirects.py \
--base-url "$(site_url)" \
--output-dir _build/html \
--myst-config myst.yml
# school can be columbia, nyu, or omitted for both. Live-reloads; set PREVIEW_NO_SERVE=1 for a one-off static build.
preview:
./extras/scripts/preview.sh $(school)
setup:
uv sync
uv pip install --python .venv/bin/python \
-r extras/autograder/source/requirements.txt
update_packages:
uv sync --upgrade
./extras/scripts/update_lectures.sh
@echo "Please update homework notebooks separately, in python-public-policy-assignments"
# based on https://gradescope-autograders.readthedocs.io/en/latest/manual_docker/
autograde:
mkdir -p ./extras/autograder/results ./extras/autograder/results
docker run --rm \
-v ./extras/autograder:/autograder \
gradescope/autograder-base \
/bin/bash -c "/autograder/source/setup.sh && /autograder/source/run_autograder"
cat ./extras/autograder/results/results.json
build_autograder:
# https://stackoverflow.com/a/17351814/358804
git archive -o ./extras/autograder.zip HEAD:./extras/autograder/source
@echo "Now upload extras/autograder.zip to Gradescope."
# removes the local preview (see preview.sh), including its Git worktrees, plus any stray build output
clean:
rm -rf tmp/preview _build
git worktree prune