Create a gist now

Instantly share code, notes, and snippets.

Makefile to export jupyterhub notebooks for all users to html
#
# Makefile to export ipython notebooks in each user home to html
# The output goes to build/$USER/$FILENAME.html
#
SOURCES=$(wildcard /home/*/*.ipynb)
TARGETS=$(shell echo $(SOURCES) | sed -e 's/.ipynb/.html/g' -e 's,/home/,build/,g')
default: $(TARGETS)
debug:
@echo SOURCES: $(SOURCES)
@echo TARGETS: $(TARGETS)
build/%.html: /home/%.ipynb
@mkdir -p `dirname $@`
jupyter nbconvert --to html --stdout $< > $@
clean:
-rm $(TARGETS)
loop:
@while echo; do make; sleep 2; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment