Description
Further to our discussion this morning, I converted animate's simple_metric.py
demo to a format suitable for converting it to a Jupyter notebook using jupytext. This is very simple - I just had to add # %% [markdown]
before text blocks and # %%
before code blocks. This is actually standard formatting - I noticed now that VS code automatically recognised it in the .py script and asked me to run each of these partition interactively. So that's nice too :)
So my idea was to keep demos in this .py format and then only convert them to notebooks when building the website. This can be easily done in command line or in a python script, e.g.:
import jupytext
nb = jupytext.read('simple_metric.py')
jupytext.write(nb, 'simple_metric.ipynb', fmt='.ipynb')
and then the notebook can be executed with jupytext --execute simple_metric.ipynb
which runs the code and produces figures in the notebook, etc.
Here is the demo script if you'd like to test it out: https://gist.github.com/ddundo/32fc425e0e1de246b06b6cf09d903818
Metadata
Metadata
Assignees
Type
Projects
Status