The Sage ZMQ Kernel

Version of the Jupyter kernel when running Sage inside the Jupyter notebook or remote Jupyter sessions.

class sage.repl.ipython_kernel.kernel.SageKernel(**kwds)

Bases: ipykernel.ipkernel.IPythonKernel

The Sage Jupyter Kernel

INPUT:

See the Jupyter documentation

EXAMPLES:

sage: from sage.repl.ipython_kernel.kernel import SageKernel
sage: SageKernel.__new__(SageKernel)
<sage.repl.ipython_kernel.kernel.SageKernel object at 0x...>
banner

The Sage Banner

The value of this property is displayed in the Jupyter notebook.

OUTPUT:

String.

EXAMPLES:

sage: from sage.repl.ipython_kernel.kernel import SageKernel
sage: sk = SageKernel.__new__(SageKernel)
sage: print(sk.banner)
┌...SageMath version...

Help in the Jupyter Notebook

OUTPUT:

See the Jupyter documentation.

Note

Urls starting with “kernelspecs” are prepended by the browser with the appropriate path.

EXAMPLES:

sage: from sage.repl.ipython_kernel.kernel import SageKernel
sage: sk = SageKernel.__new__(SageKernel)
sage: sk.help_links
[{'text': 'Sage Documentation',
  'url': 'kernelspecs/sagemath/doc/index.html'},
 ...]
pre_handler_hook()

Restore the signal handlers to their default values at Sage startup, saving the old handler at the saved_sigint_handler attribute. This is needed because Jupyter needs to change the SIGINT handler.

See trac ticket #19135.

shell_class

A trait whose value must be a subclass of a specified class.

class sage.repl.ipython_kernel.kernel.SageZMQInteractiveShell(ipython_dir=None, profile_dir=None, user_module=None, user_ns=None, custom_exceptions=(), None, **kwargs)

Bases: sage.repl.interpreter.SageNotebookInteractiveShell, ipykernel.zmqshell.ZMQInteractiveShell