Environment:
Every time I shut down a IPython notebook and re-open it, I have to re-run all the cells. But some cells
Use the cache magic.
%cache myVar = someSlowCalculation(some, "parameters")
This will calculate someSlowCalculation(some, "parameters") once. And in subsequent calls it restores myVar from storage.
https://pypi.org/project/ipython-cache/
Under the hood it does pretty much the same as the accepted answer.