Re: storing variables *in* the notebook
Zoltán Vörös <[email protected]> Thu, 26 Jan 2017 21:47:50 +0100
| Newsgroups | gmane.comp.python.ipython.devel |
|---|---|
| Message-ID | <[email protected]> |
William, Thanks for the comment, I will keep a tab on this issue. Cheers, Zoltán On 01/26/2017 09:26 PM, William Stein wrote: > 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 > <[email protected]> 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 >> [email protected] >> https://mail.scipy.org/mailman/listinfo/ipython-dev >> > > _______________________________________________ IPython-dev mailing list [email protected] https://mail.scipy.org/mailman/listinfo/ipython-dev