Any way to automatically save (some) outputs as separate files?

I’m basically in the situation where some of my cells generate really large (~20Mb) Plotly plots. I would like to save the plot to an external file to ease with version controling the notebook, but when I make the plot, and if the right file exists when reopening a notebook, I would like it to be displayed in the notebook directly. Is there anything providing functionality like that (ideally with Julia kernels)? Thanks!

hi @marius!
You can use JupyText for this: Paired notebooks — Jupytext documentation
That’s a project that pairs your jupyter .ipynb files with a .md file.
This .md file contains all info from your notebook, except the cell output.
Markdown files also diff well in git, and they don’t take much space.
You can put the .ipynb extension into the git ignore and continue to work on the ipynb files as you would normally do.
In Git, you can then commit the synchronized .md files.

Thanks for the suggestion. I’ve used Jupytext before and like it, but I think what I want (and I know it may be a niche ask, I’m just fishing for ideas) is that just some plots are stored as separate files (in my case, the few cells with these massive Plotly plots). For other text outputs and for regular plots, I do want these in the notebook so I can just version control the whole notebook for easy pulling up and looking at plots. With Jupytext I suppose its all or none. But perhaps I should think more about what a potential Jupytext-based solution would look like.

1 Like

I see, that’s tricky!
Can you maybe save the plotly plots in low resolution before the commit?
This answer from another thread may also be of use to you as inspiration: