Skip to content

Instantly share code, notes, and snippets.

Created Jun 10, 2020
What would you like to do?
Notebook to Docs.
# Python Bits
VENV = /tmp/Kalman-and-Bayesian-Filters-in-Python
.PHONY: venv
venv: ${VENV}
@python3.8 -mvenv ${@}
@${VENV}/bin/pip install --upgrade pip setuptools wheel
@${VENV}/bin/pip install --upgrade --requirement requirements.txt
.PHONY: notebook
## Make Documentation
# Generate the README from the Jupyter Notebook. README.ipynb
jupyter-nbconvert --ExecutePreprocessor.timeout=600 --execute --to markdown --output=${@} ${<}
rm -rf docs
# All other documents.
IPYNB:=$(wildcard *.ipynb)
MD:=$(patsubst %.ipynb,docs/markdown/,${IPYNB})
PDF:=$(patsubst %.ipynb,docs/pdf/%.pdf,${IPYNB})
HTML:=$(patsubst %.ipynb,docs/html/%.html,${IPYNB})
.PHONY: docs
docs: ${MD} ${PDF} ${HTML}
docs/markdown/ %.ipynb
mkdir -p `dirname ${@}`
jupyter-nbconvert --ExecutePreprocessor.timeout=600 --execute --to markdown --output=${@} ${<}
docs/pdf/%.pdf: %.ipynb
mkdir -p `dirname ${@}`
-jupyter-nbconvert --ExecutePreprocessor.timeout=600 --execute --to pdf --output=${@} ${<}
docs/html/%.html: %.ipynb
mkdir -p `dirname ${@}`
jupyter-nbconvert --ExecutePreprocessor.timeout=600 --execute --to html --output=${@} ${<}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment