I usually have to rerun (most parts of) a notebook when reopen it, in order to get access to previously defined variables and go on working.
However, sometimes I'd like to skip some of the cells, which have no influence to subsequent cells (e.g., they might comprise a branch of analysis that is finished) and could take very long time to run. These cells can be scattered throughout the notebook, so that something like "Run All Below" won't help much.
Is there a way to achieve this?
Ideally, those cells could be tagged with some special flags, so that they could be "Run" manually, but would be skipped when "Run All".
EDIT
%%cache
(ipycache extension) as suggested by @Jakob solves the problem to some extent.
Actually, I don't even need to load any variables (which can be large but unnecessary for following cells) when re-run, only the stored output matters as analyzing results.
As a work-around, put %%cache folder/unique_identifier
to the beginning of the cell. The code will be executed only once and no variables will be loaded when re-run unless you delete the unique_identifier file.
Unfortunately, all the output results are lost when re-run with %%cache
...
EDIT II (Oct 14, 2013)
The master version of ipython+ipycache now pickles (and re-displays) the codecell output as well.
For rich display outputs including Latex, HTML(pandas DataFrame output), remember to use IPython's display() method, e.g., display(Latex(r'$alpha_1$'))
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…