Created
November 17, 2020 14:43
-
-
Save natsukium/23cf7726489a500fd8700f2436ebb64d to your computer and use it in GitHub Desktop.
py2html with jupytext and nbconvert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NOTEDIR := src/notebooks | |
NOTESRC := $(wildcard $(NOTEDIR)/*.py) | |
HTML := $(addprefix outputs/, $(notdir $(NOTESRC:%.py=%.html))) | |
JUPYTEXT := poetry run jupytext --to notebook | |
NBCONVERT := poetry run jupyter nbconvert --to html | |
.PRECIOUS: %.ipynb | |
.PHONY: html | |
html: outputs/timestamp | |
outputs/timestamp: $(HTML) | |
touch $@ | |
outputs/%.html: src/notebooks/%.ipynb | |
$(NBCONVERT) $^ --output-dir outputs | |
%.ipynb: %.py | |
$(JUPYTEXT) --set-kernel python3 --execute $^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment