-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (48 loc) · 1.86 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
# by default, each line in the markfile will run in a different shell.
# The .ONESHELL: command allow us to run all the commands inside an operation in the same shell.
.ONESHELL:
SHELL = /bin/bash
# Name of the conda environment
CONDA_ENV_NAME = diabetes_analysis
# install the environment
.PHONY: env
env:
source /srv/conda/etc/profile.d/conda.sh # configure shell to use 'conda activate'.
conda env create -f environment.yml -p ~/envs/$(CONDA_ENV_NAME)
conda activate $(CONDA_ENV_NAME)
python -m ipykernel install --user --name $(CONDA_ENV_NAME) --display-name "$(CONDA_ENV_NAME)"
# run all the notebooks
.PHONY: all
all:
jupyter execute notebooks/EDA.ipynb --kernel_name=$(CONDA_ENV_NAME)
jupyter execute notebooks/main.ipynb --kernel_name=$(CONDA_ENV_NAME)
# remove the environment
.PHONY: remove-env
remove-env:
source /srv/conda/etc/profile.d/conda.sh # configure shell to use 'conda activate'.
conda deactivate
mamba env remove -n $(CONDA_ENV_NAME)
# update the environment
.PHONY: update-env
update-env:
mamba env update --file environment.yml --prune
conda activate $(CONDA_ENV_NAME)
python -m ipykernel install --user --name $(CONDA_ENV_NAME) --display-name "$(CONDA_ENV_NAME)"
# build the JupyterBook normally
.PHONY: html
html:
jupyter-book build .
## - html-hub: build static website so it can be viewed on hosted JupyterHub (via URL proxy).
.PHONY: html-hub
html-hub: conf.py
sphinx-build . _build/html -D html_baseurl=${JUPYTERHUB_SERVICE_PREFIX}proxy/absolute/8000
@echo
@echo "To start the Python http server, use:"
@echo "python -m http.server --directory ${PWD}/_build/html"
@echo "and visit this link with your browser:"
@echo "https://stat159.datahub.berkeley.edu/user-redirect/proxy/8000/index.html"
# clean up the generated figures, tables and _build folders.
.PHONY: clean
clean:
rm -rf figures/* _build/*
cd figures && touch .gitkeep