-
Notifications
You must be signed in to change notification settings - Fork 509
/
Makefile
50 lines (37 loc) · 1.93 KB
/
Makefile
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
PYTHON_SCRIPTS_DIR = python_scripts
NOTEBOOKS_DIR = notebooks
JUPYTER_BOOK_DIR = jupyter-book
JUPYTER_KERNEL := python3
MINIMAL_NOTEBOOK_FILES = $(shell ls $(PYTHON_SCRIPTS_DIR)/*.py | perl -pe "s@$(PYTHON_SCRIPTS_DIR)@$(NOTEBOOKS_DIR)@" | perl -pe "s@\[email protected]@")
# This assumes that the folder mooc-scikit-learn-coordination and
# scikit-learn-mooc are siblings, e.g. the repos are in the
# ~/dev/mooc-scikit-learn-coordination and ~/dev/scikit-learn-mooc. This should
# be the case in most development setups. If not then you can pass the
# GITLAB_REPO_JUPYTERBOOK_DIR variable with
# make -e GITLAB_REPO_JUPYTERBOOK_DIR=your/gitlab/repo/jupyter-book-dir/goes-here
GITLAB_REPO_JUPYTERBOOK_DIR = ../mooc-scikit-learn-coordination/jupyter-book
all: $(NOTEBOOKS_DIR)
.PHONY: $(NOTEBOOKS_DIR) copy_matplotlibrc sanity_check_$(NOTEBOOKS_DIR) all \
exercises quizzes $(JUPYTER_BOOK_DIR) $(JUPYTER_BOOK_DIR)-clean $(JUPYTER_BOOK_DIR)-full-clean
$(NOTEBOOKS_DIR): $(MINIMAL_NOTEBOOK_FILES) copy_matplotlibrc sanity_check_$(NOTEBOOKS_DIR)
$(NOTEBOOKS_DIR)/%.ipynb: $(PYTHON_SCRIPTS_DIR)/%.py
python build_tools/convert-python-script-to-notebook.py $< $@
copy_matplotlibrc:
cp $(PYTHON_SCRIPTS_DIR)/matplotlibrc $(NOTEBOOKS_DIR)/
sanity_check_$(NOTEBOOKS_DIR):
python build_tools/sanity-check.py $(PYTHON_SCRIPTS_DIR) $(NOTEBOOKS_DIR)
exercises:
python build_tools/generate-exercise-from-solution.py $(PYTHON_SCRIPTS_DIR)
quizzes:
python build_tools/generate-quizzes.py $(GITLAB_REPO_JUPYTERBOOK_DIR) $(JUPYTER_BOOK_DIR)
full-index:
python build_tools/generate-index.py
$(JUPYTER_BOOK_DIR):
jupyter-book build $(JUPYTER_BOOK_DIR)
rm -rf $(JUPYTER_BOOK_DIR)/_build/html/{slides,figures} && cp -r slides figures $(JUPYTER_BOOK_DIR)/_build/html
$(JUPYTER_BOOK_DIR)-clean:
# keep jupyter-cache cache folder
jupyter-book clean $(JUPYTER_BOOK_DIR)
$(JUPYTER_BOOK_DIR)-full-clean:
# deletes jupyter-cache cache folder
rm -rf $(JUPYTER_BOOK_DIR)/_build