-
Notifications
You must be signed in to change notification settings - Fork 42
/
Makefile
40 lines (27 loc) · 1.09 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
HEXBIN_OUT = images/hexbin.jpg _data/hexbin.json
HEXBIN_IN = _data/hexbin.yaml _data/hexbin.py
NOTEBOOKS := $(shell find . -name '*.ipynb' -not -path "*.ipynb_checkpoints/*" -not -path "./_site/*" -not -path "./_data/*")
NOTEBOOKS_HTML := $(NOTEBOOKS:%.ipynb=%.ipynb.raw.html)
NOTEBOOKS_MD := $(NOTEBOOKS:%.ipynb=%.ipynb.md)
YAML_FILES_IN := $(wildcard _data/simulations/*/meta.yaml)
YAML_FILES_OUT := $(subst meta.yaml,meta.yaml.out,$(YAML_FILES_IN))
.PHONY: clean build_charts
all: hexbin notebooks simulations
$(HEXBIN_OUT): $(HEXBIN_IN)
python _data/hexbin.py
%.ipynb.raw.html: %.ipynb
jupyter-nbconvert $< --output $(notdir $@) --to html --template basic
if [ "results/" = "$(dir $@)" ]; then \
sed -i '1i {\% raw \%}' $@; \
sed -i -e '$$a{\% endraw \%}' $@; \
fi
%.ipynb.md: %.ipynb
cp -n ./template.ipynb.md $@
sed -i -- 's/notebook_name/$(notdir $<)/' $@
%.yaml.out: %.yaml
pykwalify -d $< -s _data/simulations/example/schema.yaml
yamllint: $(YAML_FILES_OUT)
simulations: yamllint
hexbin: $(HEXBIN_OUT)
notebooks: $(NOTEBOOKS_HTML) $(NOTEBOOKS_MD)
print-% : ; @echo $* = $($*)