Sage-Enhanced IPython Notebook

Note

The customized Jinja2 templates for the IPython notebook are in SAGE_LOCAL/share/sage/ext/ipython-notebook. You may have to update them as well when updating to a new IPython version.

class sage.repl.notebook_ipython.SageNotebookApp(**kwargs)

Bases: IPython.html.notebookapp.NotebookApp

crash_handler_class

alias of SageCrashHandler

init_kernel_argv()

Construct the kernel arguments

The kernel is running in a separate process, so it does not see our config dictionary. Any options need to be passed through the command line interface.

EXAMPLES:

sage: from sage.repl.notebook_ipython import SageNotebookApp
sage: d = tmp_dir()
sage: IPYTHONDIR = os.environ['IPYTHONDIR']
sage: os.environ['IPYTHONDIR'] = d
sage: app = SageNotebookApp()   # optional - ssl
sage: app.kernel_argv           # optional - ssl
[]
sage: app.init_kernel_argv()    # optional - ssl, random output
2014-09-16 23:57:35.6 [SageNotebookApp] Created profile dir: 
u'/home/vbraun/.sage/temp/desktop.localdomain/1490/dir_ZQupP5/profile_default'
sage: app.kernel_argv           # optional - ssl
[u"--IPKernelApp.parent_appname='sage-notebook-ipython'",
 '--profile-dir',
 u'/.../profile_default',
 u'--IPKernelApp.kernel_class=sage.repl.zmq_kernel.SageKernel',
 u'--IPKernelApp.extra_extension=sage']
sage: os.environ['IPYTHONDIR'] = IPYTHONDIR
load_config_file(*args, **kwds)

Merges a config file with the default sage notebook config.

EXAMPLES:

sage: from sage.misc.temporary_file import tmp_dir
sage: from sage.repl.notebook_ipython import SageNotebookApp
sage: d = tmp_dir()
sage: IPYTHONDIR = os.environ['IPYTHONDIR']
sage: os.environ['IPYTHONDIR'] = d
sage: app = SageNotebookApp()   # optional - ssl
sage: app.load_config_file()    # optional - ssl, random output
2014-09-16 23:57:35.6 [SageNotebookApp] Created profile dir: 
u'/home/vbraun/.sage/temp/desktop.localdomain/1490/dir_ZQupP5/profile_default'
sage: app.notebook_dir          # random output, optional - ssl
u'/home/vbraun/'
sage: os.environ['IPYTHONDIR'] = IPYTHONDIR
sage.repl.notebook_ipython.have_prerequisites()

Check that we have all prerequisites to run the IPython notebook.

In particular, the IPython notebook requires OpenSSL whether or not you are using https. See trac:17318.

OUTPUT:

Boolean.

EXAMPLES:

sage: from sage.repl.notebook_ipython import have_prerequisites
sage: have_prerequisites() in [True, False]
True

Previous topic

Sage’s IPython Extension

Next topic

The Sage Preparser

This Page