[IPython-dev] Adding attributes to .ipynb files

Dennis Sun dlsun at stanford.edu
Thu Jun 14 19:13:21 EDT 2012

Hi all,

We're working on a project where we need notebook files that have some
extra data attached to each cell. Because we would like to make sure that
the files are still compatible with the iPython Notebook, what we're doing
right now is including this metadata in the "json" attribute of the output
of each cell and then "promoting" these attributes to the cell level at
runtime. Thus, the notebook file is still a valid .ipynb file, but the
metadata doesn't show up when the user loads the page.

However, it seems right now that we can get away with adding the metadata
directly at the cell level in the .ipynb file, since iPython Notebook
simply passes over any keys that it doesn't know to look for. We would like
to do this instead, since it is conceptually much cleaner, but we are
worried about compatibility with future versions of iPython, which might
enforce .ipynb files to follow a certain format.

We were hoping that someone more knowledgeable about the state of iPython
development could advise on whether or not it's safe to add our own
attributes directly to the .ipynb files. It seems that this shouldn't be a
problem as long as .ipynb remains a JSON key-value store, but we wanted to
check with the community to make sure.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20120614/0042bd27/attachment.html>

More information about the IPython-dev mailing list