IPython Documentation

Table Of Contents

Previous topic

Module: html.services.notebooks.handlers

Next topic

Module: html.tree.handlers

This Page


This documentation is for an old version of IPython. You can find docs for newer versions here.

Module: html.services.notebooks.nbmanager

A base class notebook manager.


  • Brian Granger

1 Class

class IPython.html.services.notebooks.nbmanager.NotebookManager(**kwargs)

Bases: IPython.config.configurable.LoggingConfigurable


Copy an existing notebook and return its notebook_id.


Create a checkpoint of the current state of a notebook

Returns a checkpoint_id for the new checkpoint.

delete_checkpoint(notebook_id, checkpoint_id)

delete a checkpoint for a notebook


Delete notebook by notebook_id.


Delete a notebook’s id in the mapping.

This doesn’t delete the actual notebook, only its entry in the mapping.

get_notebook(notebook_id, format=u'json')

Get the representation of a notebook in format by notebook_id.


Increment a filename to make it unique.

This exists for notebook stores that must have unique names. When a notebook is created or copied this method constructs a unique filename, typically by appending an integer to the name.


Return a list of checkpoints for a given notebook


List all notebooks.

This returns a list of dicts, each of the form:


This list of dicts should be sorted by name:

data = sorted(data, key=lambda item: item['name'])

Load the notebook names into memory.

This should be called once immediately after the notebook manager is created to load the existing notebooks into the mapping in memory.


Create a new notebook and return its notebook_id.


Generate a new notebook_id for a name and store its mapping.


Does a notebook exist?


Get the object representation of a notebook by notebook_id.

restore_checkpoint(notebook_id, checkpoint_id)

Restore a notebook from one of its checkpoints

save_new_notebook(data, name=None, format=u'json')

Save a new notebook and return its notebook_id.

If a name is passed in, it overrides any values in the notebook data and the value in the data is updated to use that value.

save_notebook(notebook_id, data, name=None, format=u'json')

Save an existing notebook by notebook_id.

write_notebook_object(nb, notebook_id=None)

Write a notebook object and return its notebook_id.

If notebook_id is None, this method should create a new notebook_id. If notebook_id is not None, this method should check to make sure it exists and is valid.