[IPython-dev] API to Modify Notebook Metadata
Matthias Bussonnier
bussonniermatthias at gmail.com
Sun Sep 14 03:25:07 EDT 2014
I suppose the answer will be that the kernel does not know it is runned from a notebook, so no, no python API to manipulate the document. Storing provenance of data files and library is out of scope for IPython.
Have a look at Konrad hinsen active paper that is made to do that and work with notebook.
Envoyé de mon iPhone
> Le 14 sept. 2014 à 05:51, Jason Grout <jason-sage at creativetrax.com> a écrit :
>
>
>
>> On 9/13/14, 17:55, MinRK wrote:
>> It’s relatively straightforward to do this from Javascript:
>>
>> |IPython.notebook.metadata.key ="value";
>> |
>>
>> There isn’t an API to use from Python, other than raw execution of the
>> above javascript:
>>
>> |from IPython.displayimport display_javascript
>> display_javascript('IPython.notebook.metadata.key = "value";', raw=True)
>> |
>
>
> That display_javascript won't work once the iframe security mechanisms
> are introduced, will it? I think it would be really useful to have a
> natural way to access/modify the notebook metadata dict from python. Or
> more generally, a way to store some metadata information about the
> current session that should be available the next time this code is run
> or be available as part of the metadata for the current "document" of
> code (whatever that means in the current context).
>
> Perhaps we could have something like having
> get_ipython().notebook.metadata be an eventful dict that synchronizes
> with the javascript.
>
> I know this discussion of whether the kernel should be aware of the
> frontend has come up before in various contexts, and I think it will
> keep coming up.
>
> Jason
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
More information about the IPython-dev
mailing list