/
Makefile
51 lines (34 loc) · 1.08 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
51
# Makefile for HTML for Jupyter Notebooks
MAKEDIR=build
OUTDIR=$(MAKEDIR)/html
VENVDIR=$(MAKEDIR)/venv
# NOTE: only Python3 notebooks are being built. astroquery_example_sitelle.ipynb
# is a Python2 notebook
NBFILES = $(shell grep -l '"version": 3' astroquery_example_*)
NBCONVERT = jupyter nbconvert --output-dir=./$(OUTDIR) --to html
objects := $(patsubst %.ipynb,$(OUTDIR)/%.html,$(NBFILES))
.PHONY: build clean help
build: $(VENVDIR) $(objects)
$(objects): $(OUTDIR)/%.html: %.ipynb
@echo $<
@echo NOTEBOOK FILES: $(NBFILES)
@echo TARGET: $^
@echo Converting notebooks to HTML
$(NBCONVERT) --ExecutePreprocessor.timeout=-1 --execute $<
@echo DONE
$(VENVDIR): requirements3.txt
rm -fR $(VENVDIR) ;\
mkdir $(VENVDIR) ;\
python3 -m venv ./$(VENVDIR) ;\
source ./$(VENVDIR)/bin/activate ;\
@echo Installing requirements
pip install -U pip ;\
pip install jupyter jupyter_contrib_nbextensions ;\
pip install -r requirements3.txt ;
clean:
rm -rf $(MAKEDIR)/* ;\
help:
@echo "make"
@echo " Convert Jupyter notebooks to html"
@echo "make clean"
@echo " Remove html directory"