TUDelft-CITG / MUDE

Jupyter Book for weeks 2.7 and 2.8 of MUDE (CEGM1000)
https://tudelft-citg.github.io/MUDE/intro.html
Other
2 stars 0 forks source link

Makefile for generating Jupyter Book and figures #13

Closed CasparJungbacker closed 1 year ago

CasparJungbacker commented 1 year ago

@rlanzafame and I have discussed the best way to include code that produces figures in the Jupyter Book. The new workflow is described in recipes.md. To accommodate this workflow, I made a Makefile that generates the figures and the Jupyter Book itself. The command for testing the book is also included in there.

Features:

review-notebook-app[bot] commented 1 year ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

rlanzafame commented 1 year ago

besides the one comment above, this looks great! Next step I will replace a few figures with the code so that there is a working example in the book.

CasparJungbacker commented 1 year ago

@CasparJungbacker i was thinking about why the .svg files are removed in the cleaning step. Let me know if the following is correct: .py files create the figure, which makes .svg file in figures directory. Then when the book is built all figures are also included in the HTML source (_build directory), so there is no reason to duplicate them since the .svg files in the HTML dir will remain as-is as long as there is no change to the *.py file that generated it.

Yeah you're right. On your local machine, if you don't run make clean, Make does not rebuild the figures in between Jupyter Book builds. In between pipelines, figures are not preserved in the figures directory, but they are cached in the _build directory (but Make is not aware of this). This is not a huge problem right now, since building figures does not form the majority of the building time as we do not have a lot of them. There should be some way to edit the Makefile so that it's aware of the _build directory. I'll make an issue out of this for the future 👍