[IPython-User] notebook cell URLs?

Matthias BUSSONNIER bussonniermatthias@gmail....
Fri Sep 28 03:17:08 CDT 2012


Le 27 sept. 2012 à 23:44, Darren Govoni a écrit :

> Hi,
>   I thought of an interesting idea to maybe add to ipython notebook server.
> 
> Perhaps the cells on a notebook can be referenced individually via a URL (e.g. using a # to subreference the cell),

This cold be done, at least to jump to some point of the notebook, still need some JS refactor and small evolution of the convention of what is stored
in notebook format. I looked at it some time ago, but I don't had enough JS foo right now.

> and in doing so, the notebook server would evaluate that cell and simply return the mime based result directly
> to the browser.

This is IMHO not a really good idea. A cell is linked to a kernel, and the kernel has a state, so successive call might return different result. 
We try to stay REST.

Also we think of notebook as an archive, which should be consistent, having 'shared cell' is against this philosophy, and is dangerous has it could have a lot of side effects.

Shared code should be  put in modules, and imported. 
Notebook should in the long term allow to edit files, there are way to do it now, but a little hackish (look for %%file and %load)

Nothing prevent you from using a custom backend to store cell separately and merge them into a notebook file at load time. 
I recommend you to look at json schema/json ref/json pointer (drafts) that allows you to reference an external json file as a subpart of another json file.

> In this way, cells can also be used as services to de-reference individually in an ecosystem of interacting cells. The notebooks
> could still exist for editing the cells, etc.

As we often have several notebooks opened, you might have conflicting version of cell, which is annoying and we don't want to reinvent filesystems and database.

> We would want something like this to use cells as the backend for widgets, performing some computation and returning some desired
> result. It would make things very cool and easy.

I'm not quite sure I understand what you want to do, but nothing prevent you to use an external process that do computation and give you the result. 
You should even be able to make a widget that fetch result from another url than the current kernel if you wish to.

With a more concrete example we can maybe figure out how you could use IPython to do what you want to do.

 -- 
Matthias





More information about the IPython-User mailing list