IPython Documentation

Table Of Contents

Previous topic

Module: html.services.notebooks.handlers

Next topic

Module: html.tree.handlers

This Page

Warning

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.

Authors:

  • Brian Granger

1 Class

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

Bases: IPython.config.configurable.LoggingConfigurable

copy_notebook(notebook_id)

Copy an existing notebook and return its notebook_id.

create_checkpoint(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(notebook_id)

Delete notebook by notebook_id.

delete_notebook_id(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_filename(name)

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.

list_checkpoints(notebook_id)

Return a list of checkpoints for a given notebook

list_notebooks()

List all notebooks.

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

dict(notebook_id=notebook,name=name)

This list of dicts should be sorted by name:

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

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.

new_notebook()

Create a new notebook and return its notebook_id.

new_notebook_id(name)

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

notebook_exists(notebook_id)

Does a notebook exist?

read_notebook_object(notebook_id)

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.