diff --git a/src/bin/sage b/src/bin/sage index 336bd49c5f8..2d37b475a44 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -23,6 +23,7 @@ usage() { echo " -mwrank [...] -- run Sage's mwrank with given arguments" echo " -n, -notebook [...] -- start the Sage notebook (options are the same" echo " as for the notebook command in Sage)" + echo " -ipynb [...] -- start the Sage Ipython notebook" echo " -optional -- list all optional packages that can be installed" echo " -python [...] -- run the Python interpreter" echo " -R [...] -- run Sage's R with given arguments" @@ -633,6 +634,12 @@ if [ "$1" = "-notebook" -o "$1" = '--notebook' -o "$1" = '-n' ]; then exec sage-notebook "$@" fi +if [ "$1" = "-ipynb" -o "$1" = '--ipython-notebook' ]; then + shift + sage-cleaner &>/dev/null & + exec sage-ipython-notebook "$@" +fi + if [ "$1" = "-bn" -o "$1" = "--build-and-notebook" ]; then shift build_sage diff --git a/src/bin/sage-ipython-notebook b/src/bin/sage-ipython-notebook new file mode 100755 index 00000000000..46e8c36fae3 --- /dev/null +++ b/src/bin/sage-ipython-notebook @@ -0,0 +1,10 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Sage IPython Notebook startup script. +""" +from sage.repl.ipython_notebook import SageNotebookApp + +app = SageNotebookApp.instance() +app.initialize() +app.start() diff --git a/src/sage/repl/ipython_notebook.py b/src/sage/repl/ipython_notebook.py new file mode 100644 index 00000000000..9ad5e4e2bad --- /dev/null +++ b/src/sage/repl/ipython_notebook.py @@ -0,0 +1,12 @@ +""" +Sage Extensions for the IPython Notebook +""" + +from IPython.html.notebookapp import NotebookApp + +from sage.repl.interpreter import SageCrashHandler + + +class SageNotebookApp(NotebookApp): + + pass