-
Notifications
You must be signed in to change notification settings - Fork 105
/
Makefile
102 lines (89 loc) · 2.7 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
.PHONY: all html
lab:
docker run --rm \
-p 4000:4000 \
-p 8888:8888 \
--user root \
-e NB_UID=$UID \
-e NB_GID=100 \
-v ${PWD}:/home/jovyan/work \
darribas/gds_dev:7.0
lablocal:
docker run --rm \
-p 4000:4000 \
-p 8888:8888 \
--user root \
-e NB_UID=1000 \
-e NB_GID=1000 \
-v ${PWD}:/home/jovyan/work \
darribas/gds_dev:7.0
sync:
jupytext --sync ./notebooks/*.ipynb
rerun:
echo "import matplotlib.pyplot as plt\nplt.rcParams['figure.dpi']=300" \
> ~/.ipython/profile_default/startup/00.py
jupyter nbconvert --to notebook\
--execute \
--output-dir=build \
--ExecutePreprocessor.timeout=600 \
--ExecutePreprocessor.ipython_hist_file='' \
notebooks/*ipynb
mv build/*ipynb ./notebooks/
make sync
rm ~/.ipython/profile_default/startup/00.py
html: sync
echo "Cleaning up existing tmp_book folder..."
rm -rf docs
rm -rf tmp_book
echo "Populating build folder..."
mkdir tmp_book
mkdir tmp_book/notebooks
cp notebooks/*.ipynb tmp_book/notebooks/
cp notebooks/references.bib tmp_book/notebooks/
cp -r data tmp_book/data
cp -r figures tmp_book/figures
cp -r infrastructure/website_content/* tmp_book/
cp infrastructure/logo/ico_256x256.png tmp_book/logo.png
cp infrastructure/logo/favicon.ico tmp_book/favicon.ico
echo "Starting book build..."
jupyter-book build tmp_book
echo "Moving build..."
mv tmp_book/_build/html docs
echo "Cleaning up..."
rm -r tmp_book
touch docs/.nojekyll
reset_docs:
rm -rf docs/*
git checkout HEAD docs/*
# Run for example as: `make test_one nb=00_toc`
test_one:
jupyter nbconvert --to notebook \
--execute \
--ExecutePreprocessor.timeout=600 \
notebooks/$(nb).ipynb
rm notebooks/$(nb).nbconvert.ipynb
test:
rm -rf tests
mkdir tests
jupyter nbconvert --to notebook \
--execute \
--output-dir=tests \
--ExecutePreprocessor.timeout=600 \
--ExecutePreprocessor.ipython_hist_file='' \
notebooks/*.ipynb
rm -rf tests
echo "########\n\nAll blocks passed\n\n########"
pack_site: html
rm -f gdsbook_site.zip
cd docs && zip -r ../gdsbook_site.zip ./
pack_content:
rm -f gdsbook_content.zip
rm -rf gdsbook_content
mkdir gdsbook_content
mkdir gdsbook_content/notebooks
cp notebooks/*.ipynb gdsbook_content/notebooks
cp -r figures gdsbook_content/figures
cp -r data gdsbook_content/data
cp README.md gdsbook_content/README.md
cd gdsbook_content && zip -r ../gdsbook_content.zip ./
rm -r gdsbook_content