[IPython-dev] Notebook filename badness
Brian Granger
ellisonbg at gmail.com
Tue Jun 26 20:17:40 EDT 2012
Hi,
I just finished implementing a new Azure Blob Storage backend for notebooks:
https://github.com/ipython/ipython/pull/2045
It should be easy to add new notebook manager subclasses for S3 and
other stores.
While doing this, I came to the realization that our existing notebook
storage systems has a fundamental and problematic assumption:
* Notebook *names* are unique (they are used as the unique identifier
when saving notebooks).
This is a problem because our entire web application is based on
different assumptions:
* Notebook *ids* are unique. This is why our URLs are id based for example.
* Notebook names can be repeated. Our UI makes no attempt to enforce
name uniqueness.
This mismatch leads to all sorts of problems:
* Renaming a notebook to the name of an existing file overwrites that file.
* Uploading a new notebook can overwrite an existing file.
* Because notebook ids are not persisted between sessions of the
notebook server, you can't refer to them by URL and reload notebook
pages between server restarts.
I propose a simple fix to all of this:
* We create a new notebook manager that stores notebooks in a hidden
.ipynb directory. I guess we could also use a visible subdir as well.
* In that directory, we use the notebook_id as the filename:
[notebook_id].ipynb
* Each time the notebook server restarts, it reads the notebook_ids
and notebook names. This will ensure that the notebook_ids are always
the same.
As I think about adding other backends, all of the ones I can think of
will use a notebook_id as the unique notebook identifier. Note, I am
not proposing that we do away with the existing notebook manager. We
should continue to support it, but we should *not* try to fix its the
fundamental problems it has. I know there are many disadvantages to
what I am proposing, but this is where I see things going = multiple
backend notebook stores and the need to support all of them from a
common and uniform base = (notebook ids are unique, notebook names are
not)
Cheers,
Brian
--
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu and ellisonbg at gmail.com
More information about the IPython-dev
mailing list