|
1 | | -.PHONY: help book clean serve sync-docs site-publish |
| 1 | +# Name of the uv-managed project environment directory. |
| 2 | +# `uv` honors UV_PROJECT_ENVIRONMENT to place the venv somewhere other than .venv. |
| 3 | +export UV_PROJECT_ENVIRONMENT := meda |
| 4 | + |
| 5 | +# Reproducible image outputs: matplotlib honors SOURCE_DATE_EPOCH and will stamp |
| 6 | +# PNGs with a fixed timestamp instead of "now", so identical plots produce |
| 7 | +# identical bytes (and identical content-hashed filenames in _images/). |
| 8 | +# 1577836800 == 2020-01-01T00:00:00Z |
| 9 | +export SOURCE_DATE_EPOCH := 1577836800 |
| 10 | + |
| 11 | +.PHONY: help check-env book clean serve sync-docs site-publish install runall build site |
2 | 12 |
|
3 | 13 | help: |
4 | 14 | @echo "Please use 'make <target>' where <target> is one of:" |
5 | | - @echo " install to install the necessary dependencies for jupyter-book to build" |
6 | | - @echo " book to convert the content/ folder into Jekyll markdown in _build/" |
| 15 | + @echo " install to sync the 'meda' environment from uv.lock" |
| 16 | + @echo " check-env to verify the 'meda' environment matches uv.lock" |
| 17 | + @echo " book to activate 'meda' and build the Jupyter Book into _build/" |
7 | 18 | @echo " clean to clean out site build files" |
8 | 19 | @echo " runall to run all notebooks in-place, capturing outputs with the notebook" |
9 | 20 | @echo " serve to serve the repository locally with Jekyll" |
10 | 21 | @echo " build to build the site HTML and store in _site/" |
11 | | - @echo " site to build the site HTML, store in _site/, and serve with Jekyll" |
| 22 | + @echo " site to build the site HTML, store in _site/, and serve with Jekyll" |
12 | 23 | @echo " sync-docs to copy _build/html into docs/ for GitHub Pages" |
13 | 24 | @echo " site-publish to build the book and sync docs/ (book + sync-docs)" |
14 | 25 |
|
15 | 26 |
|
16 | 27 | install: |
17 | | - jupyter-book install ./ |
| 28 | + uv sync --locked |
| 29 | + |
| 30 | +# Verify that the local 'meda' environment is up-to-date with uv.lock. |
| 31 | +# `uv sync --locked --check` exits non-zero if the environment would change. |
| 32 | +check-env: |
| 33 | + @echo "Checking that '$(UV_PROJECT_ENVIRONMENT)' matches uv.lock..." |
| 34 | + uv sync --locked --check |
18 | 35 |
|
19 | | -book: |
20 | | - jupyter-book build ./ |
| 36 | +# Activate the 'meda' environment (via `uv run`) and build the book. |
| 37 | +book: check-env |
| 38 | + uv run --locked jupyter-book build ./ |
21 | 39 |
|
22 | 40 | sync-docs: |
23 | 41 | python scripts/sync_docs.py |
|
33 | 51 | serve: |
34 | 52 | bundle exec guard |
35 | 53 |
|
36 | | -build: |
37 | | - jupyter-book build ./ --overwrite |
| 54 | +build: check-env |
| 55 | + uv run --locked jupyter-book build ./ --overwrite |
38 | 56 |
|
39 | 57 | site: build |
40 | 58 | bundle exec jekyll build |
|
0 commit comments