[IPython-dev] storing variables *in* the notebook

William Stein wstein at gmail.com
Thu Jan 26 15:26:48 EST 2017


Hi Zoltán,

This is an interesting problem and idea.  Not that it would matter to
you, but we'll very likely implement this for SageMathCloud [1] using
our global blob store, which is also how we deal with graphics in a
way that keeps files small and makes copy paste between worksheets
possible.  I've made this issue:

   https://github.com/sagemathinc/smc/issues/1594

William

[1] https://cloud.sagemath.com

On Thu, Jan 26, 2017 at 11:57 AM, Loper, Jackson
<jackson_loper at brown.edu> wrote:
> Zoltán --
>
> I am very curious to know why you want the data embedded in the ipynb file,
> instead of storing a file in the same directory.  Is it so you can share
> files with colleagues?  If so, why not just share the whole directory?  Is
> it just too bulky?  Just curious as to what your motivation is.
>
> Anywho, if you really want to do it, and you're in the mood, I think it
> would be fairly straightforward to make a combined python/javascript plugin
> that allowed one to conveniently store code cells of the form
>
>   # This is a datacell.  If you do not have the datacell javascript
> extension,
>   # this code cell may look really really long.  Sorry about that.
>   x =
> pickle.loads(b"\x80\x03}q\x00(X\x07\x00\x00\x00Purposeq\x01X$\x00\x00\x00Very
> important data just for
> Kluyverq\x02X\x07\x00\x00\x00Contentq\x03X\r\x00\x00\x00You're
> great!q\x04u.")
>
> and make them appear in the notebook as a "data cell" that looks like
>
>   x = pickle.loads(<<<content abridged>>>)
>
> Such a data cell would be uneditable, but could be executed.
>
> I think the simplest way to do this would be to design an ipython widget
> that, when it comes online, adds such a "data cell" directly after the
> current one.  Creating a cell should then be as simple as
>
>   datacells.make_data_cell(varname='x',data="Hello world.")
>
> I could be missing something that makes this utterly impossible though.
>
> Cheers!
>
> Jackson Loper
> Division of Applied Math
> Brown University
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> https://mail.scipy.org/mailman/listinfo/ipython-dev
>



-- 
William (http://wstein.org)



More information about the IPython-dev mailing list