[IPython-dev] API to Modify Notebook Metadata
Jason Grout
jason-sage at creativetrax.com
Sat Sep 13 23:51:03 EDT 2014
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
More information about the IPython-dev
mailing list