[IPython-dev] storing variables *in* the notebook
Matthias Bussonnier
bussonniermatthias at gmail.com
Thu Jan 26 16:03:50 EST 2017
Thanks Zoltan,
You can try to implement a %store_in_notebook magic, but the current
abstractions layers make a lot of assumptions about how things are
running.
If you want to develop something along these lines we can try to give
you pointers.
If I were you I would go the route of a custom ContentManager which
expose actual folders as notebooks (something akin ipymd/notedown but
with folders) and start kernels in these folders.
Then you "just" zip and share the folder. That would also solve the
fact that notebooks are text-based fileformats, which are inherently
bad for binary data, andd o not support incremental updates.
One of the problem is that what you are trying to do will not work on
many system and it is relatively hard to make it part of Jupyter if it
only work on some limited use case as we'd like to have a clear
message of what is vetted by the core.
We'll be happy to be proven wrong.
Thanks,
--
Matthias
On Thu, Jan 26, 2017 at 12:47 PM, Zoltán Vörös <zvoros at gmail.com> wrote:
> 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
>> <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
>>>
>>
>>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> https://mail.scipy.org/mailman/listinfo/ipython-dev
More information about the IPython-dev
mailing list