[IPython-dev] storing variables *in* the notebook
Zoltán Vörös
zvoros at gmail.com
Thu Jan 26 02:45:01 EST 2017
Hi Thomas,
Thanks for the comments! Here are mine.
On 01/25/2017 11:20 PM, Thomas Kluyver wrote:
> On 25 January 2017 at 21:33, Zoltán Vörös <zvoros at gmail.com
> <mailto:zvoros at gmail.com>> wrote:
>
> Now, the standard answer to this problem is the %store magic, but
> that has at least two problems (one is actually more like a
> feature). First, as far as I understand, it saves the variable
> into a separate file, therefore, the notebook itself is not
> "portable" anymore: if I want to give it to someone, or use it on
> another computer, then I need the extra file, but then I could
> just save the variable in a file in the first place.
>
>
> In many cases, we think that the unit of sharing should be a directory
> containing notebooks and associated data files, rather than a notebook
> itself. Storing and retrieving data in a notebook would require
> breaking the abstraction that the code inside a notebook doesn't know
> about the document it's part of.
But by the same token, by resorting to the %store magic, the code inside
the notebook is linked to something on the file system, in fact,
surreptitiously in a way. I am afraid, I don't quite see, why and how
%store is different in this respect.
To me, one of the main appeals of the notebook is that one can write a
report/log (by this I mean create figures, do data analysis/simulation
and add context, explanation etc.) in a single document, portably, and
without clobbering the file system. I believe, the use case I mentioned
earlier is a logical extension of this concept.
The over-arching theme of the whole ipython project is that data,
analysis, presentation and narrative should not be separated. Metadata
are routinely attached to markdown cells, so why could not be done the
same for the notebook as well?
I understand that you do not want people to store GBs of data in the
notebook, but that was not the intent of the original question.
>
> ActivePapers is a different take on connecting code and data which
> does package them in a single file; I believe it has some support for
> using a Jupyter notebook as part of an ActivePaper:
> https://github.com/khinsen/activepapers-python
Thanks for the pointer, I will check it out!
Zoltán
More information about the IPython-dev
mailing list