3.10 The Notebook Interface

The Sage notebook is run by typing

sage: notebook()
on the command line of Sage. This starts the Sage notebook and opens your default web browser to view it. The server's state files are stored in $HOME/.sage/sage_notebook.

Other options include:

sage: notebook("directory")
which starts a new notebook server using files in the given directory, instead of the default directory $HOME/.sage/sage_notebook. This can be useful if you want to have a collection of worksheets associated with a specific project, or run several separate notebook servers at the same time.

When you start the notebook, it first creates the following files in $HOME/.sage/sage_notebook:

nb.sobj       (the notebook SAGE object file)
objects/      (a directory containing SAGE objects)
worksheets/   (a directory containing SAGE worksheets).

After creating the above files, the notebook starts a web server.

A ``notebook'' is a collection of user accounts, each of which can have any number of worksheets. When you create a new worksheet, the data that defines it is stored in the worksheets/username/number directories. In each such directory there is a plain text file worksheet.txt - if anything ever happens to your worksheets, or Sage, or whatever, that human-readable file contains everything needed to reconstruct your worksheet.

From within Sage type notebook? for much more about how to start a notebook server.

The following diagram illustrates the architecture of the Sage Notebook:

----------------------
|                    |
|                    |
|   firefox/safari   |
|                    |
|     javascript     |
|      program       |
|                    |
|                    |
----------------------
      |      ^
      | AJAX |
      V      |
----------------------
|                    |
|       sage         |                SAGE process 1
|       web          | ------------>  SAGE process 2    (Python processes)
|      server        |   pexpect      SAGE process 3
|                    |                    .
|                    |                    .
----------------------                    .

For help on a Sage command, cmd, in the notebook browser box, type cmd? and now hit <esc> (not <shift-enter>).

See About this document... for information on suggesting changes.