diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/debian/bzr-builder.manifest ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/debian/bzr-builder.manifest --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/debian/bzr-builder.manifest 2014-04-18 00:25:34.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/debian/bzr-builder.manifest 2014-04-21 23:54:33.000000000 +0000 @@ -1,3 +1,3 @@ -# bzr-builder format 0.3 deb-version {debupstream}+mirror1+r456+81 -lp:~jtaylor/ipython/ipython-mirror revid:jtaylor@ubuntu.com-20140417210027-kc53h1q1yggiuzyn +# bzr-builder format 0.3 deb-version {debupstream}+mirror1+r468+81 +lp:~jtaylor/ipython/ipython-mirror revid:jtaylor@ubuntu.com-20140421233347-ixp8oovmecjhoo46 merge packaging lp:~jtaylor/ipython/debian-daily revid:jtaylor@ubuntu.com-20140408190249-8x6ei1b3tnw2myl0 diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/debian/changelog ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/debian/changelog --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/debian/changelog 2014-04-18 00:25:34.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/debian/changelog 2014-04-21 23:54:33.000000000 +0000 @@ -1,8 +1,8 @@ -ipython (2.0.0+mirror1+r456+81~ubuntu12.04.1) precise; urgency=low +ipython (2.0.0+mirror1+r468+81~ubuntu12.04.1) precise; urgency=low * Auto build. - -- Julian Taylor Fri, 18 Apr 2014 00:25:34 +0000 + -- Julian Taylor Mon, 21 Apr 2014 23:54:33 +0000 ipython (2.0.0-1) unstable; urgency=medium diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/docs/source/install/install.rst ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/docs/source/install/install.rst --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/docs/source/install/install.rst 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/docs/source/install/install.rst 2014-04-21 23:54:26.000000000 +0000 @@ -174,13 +174,31 @@ $ python setupegg.py develop This creates links in the right places and installs the command line script to -the appropriate places. Then, if you want to update your IPython at any time, +the appropriate places. + +Then, if you want to update your IPython at any time, just do: .. code-block:: bash $ git pull +IPython now uses git submodules to ship its javascript dependencies. If you run +IPython from git master, you may need to update submodules once in a while with: + +.. code-block:: bash + + $ git submodule update + +or + +.. code-block:: bash + + $ python setup.py submodule + +Another option is to copy `git hooks `_ +to your ``./git/hooks/`` directory to ensure that your submodules are up to date on each pull. + Basic optional dependencies =========================== diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/docs/source/interactive/qtconsole.rst ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/docs/source/interactive/qtconsole.rst --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/docs/source/interactive/qtconsole.rst 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/docs/source/interactive/qtconsole.rst 2014-04-21 23:54:26.000000000 +0000 @@ -57,6 +57,17 @@ ...: ...: plt.show() +The ``%load`` magic can also load source code from objects in the user or +global namespace by invoking the ``-n`` option. + +.. sourcecode:: ipython + + In [1]: import hello_world + ...: %load -n hello_world.say_hello + + In [3]: def say_hello() : + ...: print("Hello World!") + Inline Matplotlib ================= diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/docs/source/notebook/notebook.rst ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/docs/source/notebook/notebook.rst --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/docs/source/notebook/notebook.rst 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/docs/source/notebook/notebook.rst 2014-04-21 23:54:26.000000000 +0000 @@ -349,52 +349,12 @@ is thus a shortcut for the sequence :kbd:`Shift-Enter`, :kbd:`Ctrl-m a`. (:kbd:`Ctrl-m a` adds a new cell above the current one.) -* :kbd:`Ctrl-m`: - This is the prefix for *all* other shortcuts, which consist of :kbd:`Ctrl-m` - followed by a single letter or character. For example, if you type - :kbd:`Ctrl-m h` (that is, the sole letter :kbd:`h` after :kbd:`Ctrl-m`), - IPython will show you all the available keyboard shortcuts. - - -.. - TODO: these live in IPython/html/static/notebook/js/quickhelp.js - They were last updated for IPython 1.0 release, so update them again for - future releases. - -Here is the complete set of keyboard shortcuts available: - -============ ========================== -**Shortcut** **Action** ------------- -------------------------- -Shift-Enter run cell -Ctrl-Enter run cell in-place -Alt-Enter run cell, insert below -Ctrl-m x cut cell -Ctrl-m c copy cell -Ctrl-m v paste cell -Ctrl-m d delete cell -Ctrl-m z undo last cell deletion -Ctrl-m - split cell -Ctrl-m a insert cell above -Ctrl-m b insert cell below -Ctrl-m o toggle output -Ctrl-m O toggle output scroll -Ctrl-m l toggle line numbers -Ctrl-m s save notebook -Ctrl-m j move cell down -Ctrl-m k move cell up -Ctrl-m y code cell -Ctrl-m m markdown cell -Ctrl-m t raw cell -Ctrl-m 1-6 heading 1-6 cell -Ctrl-m p select previous -Ctrl-m n select next -Ctrl-m i interrupt kernel -Ctrl-m . restart kernel -Ctrl-m h show keyboard shortcuts -============ ========================== - +* :kbd:`Esc` and :kbd:`Enter`: Command mode and edit mode + In command mode, you can easily navigate around the notebook using keyboard + shortcuts. In edit mode, you can edit text in cells. +For the full list of available shortcuts, click :guilabel:`Help`, +:guilabel:`Keyboard Shortcuts` in the notebook menus. Plotting -------- diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/docs/source/whatsnew/pr/clear-output-preprocessor.rst ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/docs/source/whatsnew/pr/clear-output-preprocessor.rst --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/docs/source/whatsnew/pr/clear-output-preprocessor.rst 1970-01-01 00:00:00.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/docs/source/whatsnew/pr/clear-output-preprocessor.rst 2014-04-21 23:54:26.000000000 +0000 @@ -0,0 +1 @@ +Adds an optional preprocessor step to `nbconvert` called `ClearOutputPreprocessor`. This clears the output from IPython notebooks. diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/docs/source/whatsnew/pr/load_from_namespace.rst ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/docs/source/whatsnew/pr/load_from_namespace.rst --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/docs/source/whatsnew/pr/load_from_namespace.rst 1970-01-01 00:00:00.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/docs/source/whatsnew/pr/load_from_namespace.rst 2014-04-21 23:54:26.000000000 +0000 @@ -0,0 +1,6 @@ +Adds object inspection to %load magic so that source for objects in user or global namespaces can be loaded. To enable searching the namespace, use the ``-n`` option. + +.. sourcecode:: ipython + + In [1]: %load -n my_module.some_function + diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/docs/source/whatsnew/pr/textwidget-placeholder.rst ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/docs/source/whatsnew/pr/textwidget-placeholder.rst --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/docs/source/whatsnew/pr/textwidget-placeholder.rst 1970-01-01 00:00:00.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/docs/source/whatsnew/pr/textwidget-placeholder.rst 2014-04-21 23:54:26.000000000 +0000 @@ -0,0 +1,3 @@ +* `TextWidget` and `TextareaWidget` objects now include a + `placeholder` attribute, for displaying placeholder text before the + user has typed anything. diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/examples/Interactive Widgets/Widget Basics.ipynb ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/examples/Interactive Widgets/Widget Basics.ipynb --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/examples/Interactive Widgets/Widget Basics.ipynb 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/examples/Interactive Widgets/Widget Basics.ipynb 2014-04-21 23:54:26.000000000 +0000 @@ -7,7 +7,7 @@ ] ], "name": "", - "signature": "sha256:9a70b52f0b16861d1cd6a8342b233247958977a52bde8d3efd69d21131ce1926" + "signature": "sha256:5ac3a85c8bb2f9bb3cd63b524bbb626ab1531176b43a109d13f5d7794f805eee" }, "nbformat": 3, "nbformat_minor": 0, @@ -31,7 +31,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 1 + "prompt_number": 2 }, { "cell_type": "heading", @@ -298,6 +298,39 @@ } ], "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Some widgets have special attributes. For example, text boxes and text areas can specify the `placeholder` attribute, which will set \"placeholder\" text to be displayed before the user has typed anything:" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "mytextwidget = widgets.TextWidget()\n", + "mytextwidget.placeholder = \"type something here\"\n", + "display(mytextwidget)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 4 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "mytextareawidget = widgets.TextareaWidget()\n", + "mytextareawidget.placeholder = \"your text here\"\n", + "display(mytextareawidget)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 } ], "metadata": {} diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/git-hooks/README.md ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/git-hooks/README.md --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/git-hooks/README.md 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/git-hooks/README.md 2014-04-21 23:54:26.000000000 +0000 @@ -6,4 +6,5 @@ both of which just update submodules, so make sure that you have a fully synced repo whenever you checkout or pull. -To use these hooks, run `./install-hooks.sh`. +To use these hooks, run `./install-hooks.sh`. +If you havn't initialised and updated the submodules manually, you will then need to run `git checkout master` to activate the hooks (even if you already have `master` checked out). diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/config/application.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/config/application.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/config/application.py 2014-04-18 00:25:35.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/config/application.py 2014-04-21 23:54:33.000000000 +0000 @@ -1,25 +1,11 @@ # encoding: utf-8 -""" -A base class for a configurable application. +"""A base class for a configurable application.""" -Authors: +# Copyright (c) IPython Development Team. +# Distributed under the terms of the Modified BSD License. -* Brian Granger -* Min RK -""" from __future__ import print_function -#----------------------------------------------------------------------------- -# Copyright (C) 2008-2011 The IPython Development Team -# -# Distributed under the terms of the BSD License. The full license is in -# the file COPYING, distributed as part of this software. -#----------------------------------------------------------------------------- - -#----------------------------------------------------------------------------- -# Imports -#----------------------------------------------------------------------------- - import logging import os import re @@ -43,10 +29,6 @@ from IPython.utils.py3compat import string_types, iteritems #----------------------------------------------------------------------------- -# function for re-wrapping a helpstring -#----------------------------------------------------------------------------- - -#----------------------------------------------------------------------------- # Descriptions for the various sections #----------------------------------------------------------------------------- @@ -161,6 +143,8 @@ self.log_level = new self.log.setLevel(new) + _log_formatter_cls = LevelFormatter + log_datefmt = Unicode("%Y-%m-%d %H:%M:%S", config=True, help="The date format used by logging formatters for %(asctime)s" ) @@ -173,8 +157,9 @@ def _log_format_changed(self, name, old, new): """Change the log formatter when log_format is set.""" _log_handler = self.log.handlers[0] - _log_formatter = LevelFormatter(new, datefmt=self.log_datefmt) + _log_formatter = self._log_formatter_cls(fmt=new, datefmt=self.log_datefmt) _log_handler.setFormatter(_log_formatter) + log = Instance(logging.Logger) def _log_default(self): @@ -201,7 +186,7 @@ _log_handler = logging.StreamHandler(open(os.devnull, 'w')) else: _log_handler = logging.StreamHandler() - _log_formatter = LevelFormatter(self.log_format, datefmt=self.log_datefmt) + _log_formatter = self._log_formatter_cls(fmt=self.log_format, datefmt=self.log_datefmt) _log_handler.setFormatter(_log_formatter) log.addHandler(_log_handler) return log diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/core/interactiveshell.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/core/interactiveshell.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/core/interactiveshell.py 2014-04-18 00:25:35.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/core/interactiveshell.py 2014-04-21 23:54:33.000000000 +0000 @@ -3089,7 +3089,7 @@ lines = self.history_manager.get_range_by_str(range_str, raw=raw) return "\n".join(x for _, _, x in lines) - def find_user_code(self, target, raw=True, py_only=False, skip_encoding_cookie=True): + def find_user_code(self, target, raw=True, py_only=False, skip_encoding_cookie=True, search_ns=False): """Get a code string from history, file, url, or a string or macro. This is mainly used by magic functions. @@ -3156,11 +3156,18 @@ elif os.path.isdir(os.path.expanduser(tgt)): raise ValueError("'%s' is a directory, not a regular file." % target) + if search_ns: + # Inspect namespace to load object source + object_info = self.object_inspect(target, detail_level=1) + if object_info['found'] and object_info['source']: + return object_info['source'] + try: # User namespace codeobj = eval(target, self.user_ns) except Exception: raise ValueError(("'%s' was not found in history, as a file, url, " "nor in the user namespace.") % target) + if isinstance(codeobj, string_types): return codeobj elif isinstance(codeobj, Macro): diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/core/magics/code.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/core/magics/code.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/core/magics/code.py 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/core/magics/code.py 2014-04-21 23:54:26.000000000 +0000 @@ -272,7 +272,8 @@ Usage:\\ %load [options] source - where source can be a filename, URL, input history range or macro + where source can be a filename, URL, input history range, macro, or + element in the user namespace Options: @@ -285,6 +286,8 @@ -y : Don't ask confirmation for loading source above 200 000 characters. + -n : Include the user's namespace when searching for source code. + This magic command can either take a local filename, a URL, an history range (see %history) or a macro as argument, it will prompt for confirmation before loading source with more than 200 000 characters, unless @@ -297,14 +300,18 @@ %load -r 5-10 myscript.py %load -r 10-20,30,40: foo.py %load -s MyClass,wonder_function myscript.py + %load -n MyClass + %load -n my_module.wonder_function """ - opts,args = self.parse_options(arg_s,'ys:r:') + opts,args = self.parse_options(arg_s,'yns:r:') if not args: raise UsageError('Missing filename, URL, input history range, ' - 'or macro.') + 'macro, or element in the user namespace.') + + search_ns = 'n' in opts - contents = self.shell.find_user_code(args) + contents = self.shell.find_user_code(args, search_ns=search_ns) if 's' in opts: try: diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/core/magics/osm.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/core/magics/osm.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/core/magics/osm.py 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/core/magics/osm.py 2014-04-21 23:54:26.000000000 +0000 @@ -663,8 +663,7 @@ elif 'r' in opts: bkms = {} elif 'l' in opts: - bks = bkms.keys() - bks.sort() + bks = sorted(bkms) if bks: size = max(map(len, bks)) else: diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/core/tests/test_magic.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/core/tests/test_magic.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/core/tests/test_magic.py 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/core/tests/test_magic.py 2014-04-21 23:54:26.000000000 +0000 @@ -942,3 +942,10 @@ # test _run_edit_test("1", exp_contents=ip.user_ns['In'][1], exp_is_temp=True) + +def test_bookmark(): + ip = get_ipython() + ip.run_line_magic('bookmark', 'bmname') + with tt.AssertPrints('bmname'): + ip.run_line_magic('bookmark', '-l') + ip.run_line_magic('bookmark', '-d bmname') diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/html/notebookapp.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/html/notebookapp.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/html/notebookapp.py 2014-04-18 00:25:35.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/html/notebookapp.py 2014-04-21 23:54:33.000000000 +0000 @@ -1,23 +1,11 @@ # coding: utf-8 -"""A tornado based IPython notebook server. +"""A tornado based IPython notebook server.""" -Authors: +# Copyright (c) IPython Development Team. +# Distributed under the terms of the Modified BSD License. -* Brian Granger -""" from __future__ import print_function -#----------------------------------------------------------------------------- -# Copyright (C) 2013 The IPython Development Team -# -# Distributed under the terms of the BSD License. The full license is in -# the file COPYING, distributed as part of this software. -#----------------------------------------------------------------------------- - -#----------------------------------------------------------------------------- -# Imports -#----------------------------------------------------------------------------- -# stdlib import errno import io import json @@ -33,7 +21,6 @@ import webbrowser -# Third party # check for pyzmq 2.1.11 from IPython.utils.zmqrelated import check_for_zmq check_for_zmq('2.1.11', 'IPython.html') @@ -60,8 +47,8 @@ from tornado import httpserver from tornado import web +from tornado.log import LogFormatter -# Our own libraries from IPython.html import DEFAULT_STATIC_FILES_PATH from .base.handlers import Template404 from .log import log_request @@ -75,18 +62,14 @@ from IPython.config import Config from IPython.config.application import catch_config_error, boolean_flag -from IPython.core.application import BaseIPythonApplication -from IPython.core.profiledir import ProfileDir -from IPython.consoleapp import IPythonConsoleApp -from IPython.kernel import swallow_argv -from IPython.kernel.zmq.session import default_secure -from IPython.kernel.zmq.kernelapp import ( - kernel_flags, - kernel_aliases, +from IPython.core.application import ( + BaseIPythonApplication, base_flags, base_aliases, ) +from IPython.core.profiledir import ProfileDir +from IPython.kernel import KernelManager +from IPython.kernel.zmq.session import default_secure, Session from IPython.nbformat.sign import NotebookNotary from IPython.utils.importstring import import_item -from IPython.utils.localinterfaces import localhost from IPython.utils import submodule from IPython.utils.traitlets import ( Dict, Unicode, Integer, List, Bool, Bytes, @@ -254,11 +237,15 @@ # Aliases and Flags #----------------------------------------------------------------------------- -flags = dict(kernel_flags) +flags = dict(base_flags) flags['no-browser']=( {'NotebookApp' : {'open_browser' : False}}, "Don't open the notebook in a browser after startup." ) +flags['pylab']=( + {'NotebookApp' : {'pylab' : 'warn'}}, + "DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib." +) flags['no-mathjax']=( {'NotebookApp' : {'enable_mathjax' : False}}, """Disable MathJax @@ -276,12 +263,7 @@ 'Auto-save a .py script everytime the .ipynb notebook is saved', 'Do not auto-save .py scripts for every notebook')) -# the flags that are specific to the frontend -# these must be scrubbed before being passed to the kernel, -# or it will raise an error on unrecognized flags -notebook_flags = ['no-browser', 'no-mathjax', 'script', 'no-script'] - -aliases = dict(kernel_aliases) +aliases = dict(base_aliases) aliases.update({ 'ip': 'NotebookApp.ip', @@ -292,15 +274,9 @@ 'certfile': 'NotebookApp.certfile', 'notebook-dir': 'NotebookApp.notebook_dir', 'browser': 'NotebookApp.browser', + 'pylab': 'NotebookApp.pylab', }) -# remove ipkernel flags that are singletons, and don't make sense in -# multi-kernel evironment: -aliases.pop('f', None) - -notebook_aliases = [u'port', u'port-retries', u'ip', u'keyfile', u'certfile', - u'notebook-dir', u'profile', u'profile-dir', 'browser'] - #----------------------------------------------------------------------------- # NotebookApp #----------------------------------------------------------------------------- @@ -316,9 +292,13 @@ HTML5/Javascript Notebook client. """ examples = _examples + aliases = aliases + flags = flags - classes = IPythonConsoleApp.classes + [MappingKernelManager, NotebookManager, - FileNotebookManager, NotebookNotary] + classes = [ + KernelManager, ProfileDir, Session, MappingKernelManager, + NotebookManager, FileNotebookManager, NotebookNotary, + ] flags = Dict(flags) aliases = Dict(aliases) @@ -327,13 +307,19 @@ ) kernel_argv = List(Unicode) + + _log_formatter_cls = LogFormatter def _log_level_default(self): return logging.INFO + def _log_datefmt_default(self): + """Exclude date from default date format""" + return "%H:%M:%S" + def _log_format_default(self): """override default log format to include time""" - return u"%(asctime)s.%(msecs).03d [%(name)s]%(highlevel)s %(message)s" + return u"%(color)s[%(levelname)1.1s %(asctime)s.%(msecs).03d %(name)s]%(end_color)s %(message)s" # create requested profiles by default, if they don't exist: auto_create = Bool(True) @@ -348,11 +334,9 @@ # Network related information. - ip = Unicode(config=True, + ip = Unicode('localhost', config=True, help="The IP address the notebook server will listen on." ) - def _ip_default(self): - return localhost() def _ip_changed(self, name, old, new): if new == u'*': self.ip = u'' @@ -536,6 +520,23 @@ notebook_dir = Unicode(py3compat.getcwd(), config=True, help="The directory to use for notebooks and kernels." ) + + pylab = Unicode('disabled', config=True, + help=""" + DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib. + """ + ) + def _pylab_changed(self, name, old, new): + """when --pylab is specified, display a warning and exit""" + if new != 'warn': + backend = ' %s' % new + else: + backend = '' + self.log.error("Support for specifying --pylab on the command line has been removed.") + self.log.error( + "Please use `%pylab{0}` or `%matplotlib{0}` in the notebook itself.".format(backend) + ) + self.exit(1) def _notebook_dir_changed(self, name, old, new): """Do a bit of validation of the notebook dir.""" @@ -573,16 +574,7 @@ def init_kernel_argv(self): """construct the kernel arguments""" - # Scrub frontend-specific flags - self.kernel_argv = swallow_argv(self.argv, notebook_aliases, notebook_flags) - if any(arg.startswith(u'--pylab') for arg in self.kernel_argv): - self.log.warn('\n '.join([ - "Starting all kernels in pylab mode is not recommended,", - "and will be disabled in a future release.", - "Please use the %matplotlib magic to enable matplotlib instead.", - "pylab implies many imports, which can have confusing side effects", - "and harm the reproducibility of your notebooks.", - ])) + self.kernel_argv = [] # Kernel should inherit default config file from frontend self.kernel_argv.append("--IPKernelApp.parent_appname='%s'" % self.name) # Kernel should get *absolute* path to profile directory @@ -608,10 +600,10 @@ self.log.propagate = False # hook up tornado 3's loggers to our app handlers - for name in ('access', 'application', 'general'): - logger = logging.getLogger('tornado.%s' % name) - logger.parent = self.log - logger.setLevel(self.log.level) + logger = logging.getLogger('tornado') + logger.propagate = True + logger.parent = self.log + logger.setLevel(self.log.level) def init_webapp(self): """initialize tornado webapp and httpserver""" @@ -667,7 +659,7 @@ @property def connection_url(self): - ip = self.ip if self.ip else localhost() + ip = self.ip if self.ip else 'localhost' return self._url(ip) def _url(self, ip): diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/html/static/notebook/js/outputarea.js ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/html/static/notebook/js/outputarea.js --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/html/static/notebook/js/outputarea.js 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/html/static/notebook/js/outputarea.js 2014-04-21 23:54:26.000000000 +0000 @@ -585,19 +585,45 @@ }; - var append_svg = function (svg, md, element) { + var append_svg = function (svg_html, md, element) { var type = 'image/svg+xml'; var toinsert = this.create_output_subarea(md, "output_svg", type); - toinsert.append(svg); + + // Get the svg element from within the HTML. + var svg = $('
').html(svg_html).find('svg'); + var svg_area = $('
'); + var width = svg.attr('width'); + var height = svg.attr('height'); + svg + .width('100%') + .height('100%'); + svg_area + .width(width) + .height(height); + + // The jQuery resize handlers don't seem to work on the svg element. + // When the svg renders completely, measure it's size and set the parent + // div to that size. Then set the svg to 100% the size of the parent + // div and make the parent div resizable. + this._dblclick_to_reset_size(svg_area, true, false); + + svg_area.append(svg); + toinsert.append(svg_area); element.append(toinsert); + return toinsert; }; - - OutputArea.prototype._dblclick_to_reset_size = function (img) { - // wrap image after it's loaded on the page, - // otherwise the measured initial size will be incorrect - img.on("load", function (){ + OutputArea.prototype._dblclick_to_reset_size = function (img, immediately, resize_parent) { + // Add a resize handler to an element + // + // img: jQuery element + // immediately: bool=False + // Wait for the element to load before creating the handle. + // resize_parent: bool=True + // Should the parent of the element be resized when the element is + // reset (by double click). + var callback = function (){ var h0 = img.height(); var w0 = img.width(); if (!(h0 && w0)) { @@ -610,12 +636,20 @@ }); img.dblclick(function () { // resize wrapper & image together for some reason: - img.parent().height(h0); img.height(h0); - img.parent().width(w0); img.width(w0); + if (resize_parent === undefined || resize_parent) { + img.parent().height(h0); + img.parent().width(w0); + } }); - }); + }; + + if (immediately) { + callback(); + } else { + img.on("load", callback); + } }; var set_width_height = function (img, md, mime) { diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/html/static/widgets/js/widget_string.js ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/html/static/widgets/js/widget_string.js --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/html/static/widgets/js/widget_string.js 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/html/static/widgets/js/widget_string.js 2014-04-21 23:54:26.000000000 +0000 @@ -71,6 +71,11 @@ this.update(); // Set defaults. this.model.on('msg:custom', $.proxy(this._handle_textarea_msg, this)); + this.model.on('change:placeholder', function(model, value, options) { + this.update_placeholder(value); + }, this); + + this.update_placeholder(); }, _handle_textarea_msg: function (content){ @@ -80,6 +85,13 @@ } }, + update_placeholder: function(value) { + if (!value) { + value = this.model.get('placeholder'); + } + this.$textbox.attr('placeholder', value); + }, + scroll_to_bottom: function (){ // Scroll the text-area view to the bottom. this.$textbox.scrollTop(this.$textbox[0].scrollHeight); @@ -141,6 +153,18 @@ .appendTo(this.$el); this.$el_to_style = this.$textbox; // Set default element to style this.update(); // Set defaults. + this.model.on('change:placeholder', function(model, value, options) { + this.update_placeholder(value); + }, this); + + this.update_placeholder(); + }, + + update_placeholder: function(value) { + if (!value) { + value = this.model.get('placeholder'); + } + this.$textbox.attr('placeholder', value); }, update: function(options){ diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/html/tests/widgets/widget_string.js ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/html/tests/widgets/widget_string.js --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/html/tests/widgets/widget_string.js 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/html/tests/widgets/widget_string.js 2014-04-21 23:54:26.000000000 +0000 @@ -7,8 +7,8 @@ this.execute_cell_then(index); var string_index = this.append_cell( - 'string_widget = [widgets.TextWidget(value = "xyz"),\n' + - ' widgets.TextareaWidget(value = "xyz"),\n' + + 'string_widget = [widgets.TextWidget(value = "xyz", placeholder = "abc"),\n' + + ' widgets.TextareaWidget(value = "xyz", placeholder = "def"),\n' + ' widgets.HTMLWidget(value = "xyz"),\n' + ' widgets.LatexWidget(value = "$\\\\LaTeX{}$")]\n' + '[display(widget) for widget in string_widget]\n'+ @@ -41,5 +41,13 @@ this.test.assert(this.cell_element_exists(string_index, '.widget-area .widget-subarea div span.MathJax_Preview'), 'MathJax parsed the LaTeX successfully.'); + + this.test.assert(this.cell_element_function(index, + '.widget-area .widget-subarea .widget-hbox textarea', 'attr', ['placeholder'])=='def', + 'Python set textarea placeholder.'); + + this.test.assert(this.cell_element_function(index, + '.widget-area .widget-subarea .widget-hbox-single input[type=text]', 'attr', ['placeholder'])=='abc', + 'Python set textbox placehoder.'); }); -}); \ No newline at end of file +}); diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/html/widgets/widget_bool.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/html/widgets/widget_bool.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/html/widgets/widget_bool.py 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/html/widgets/widget_bool.py 2014-04-21 23:54:26.000000000 +0000 @@ -31,4 +31,4 @@ class ToggleButtonWidget(_BoolWidget): _view_name = Unicode('ToggleButtonView', sync=True) - \ No newline at end of file + diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/html/widgets/widget_image.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/html/widgets/widget_image.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/html/widgets/widget_image.py 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/html/widgets/widget_image.py 2014-04-21 23:54:26.000000000 +0000 @@ -1,7 +1,6 @@ -"""ButtonWidget class. +"""ImageWidget class. -Represents a button in the frontend using a widget. Allows user to listen for -click events on the button and trigger backend code when the clicks are fired. +Represents an image in the frontend using a widget. """ #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. @@ -33,4 +32,4 @@ value = Bytes() def _value_changed(self, name, old, new): - self._b64value = base64.b64encode(new) \ No newline at end of file + self._b64value = base64.b64encode(new) diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/html/widgets/widget_string.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/html/widgets/widget_string.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/html/widgets/widget_string.py 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/html/widgets/widget_string.py 2014-04-21 23:54:26.000000000 +0000 @@ -23,6 +23,7 @@ value = Unicode(help="String value", sync=True) disabled = Bool(False, help="Enable or disable user changes", sync=True) description = Unicode(help="Description of the value this widget represents", sync=True) + placeholder = Unicode("", help="Placeholder text to display when nothing has been typed", sync=True) class HTMLWidget(_StringWidget): diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/lib/pretty.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/lib/pretty.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/lib/pretty.py 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/lib/pretty.py 2014-04-21 23:54:26.000000000 +0000 @@ -723,17 +723,15 @@ def _type_pprint(obj, p, cycle): """The pprint for classes and types.""" + # Heap allocated types might not have the module attribute, + # and others may set it to None. mod = _safe_getattr(obj, '__module__', None) - if mod is None: - # Heap allocated types might not have the module attribute, - # and others may set it to None. - return p.text(obj.__name__) + name = _safe_getattr(obj, '__qualname__', obj.__name__) - if mod in ('__builtin__', 'builtins', 'exceptions'): - name = obj.__name__ + if mod in (None, '__builtin__', 'builtins', 'exceptions'): + p.text(name) else: - name = mod + '.' + obj.__name__ - p.text(name) + p.text(mod + '.' + name) def _repr_pprint(obj, p, cycle): @@ -743,22 +741,18 @@ def _function_pprint(obj, p, cycle): """Base pprint for all functions and builtin functions.""" - if obj.__module__ in ('__builtin__', 'builtins', 'exceptions') or not obj.__module__: - name = obj.__name__ - else: - name = obj.__module__ + '.' + obj.__name__ + name = _safe_getattr(obj, '__qualname__', obj.__name__) + mod = obj.__module__ + if mod and mod not in ('__builtin__', 'builtins', 'exceptions'): + name = mod + '.' + name p.text('' % name) def _exception_pprint(obj, p, cycle): """Base pprint for all exceptions.""" - if obj.__class__.__module__ in ('exceptions', 'builtins'): - name = obj.__class__.__name__ - else: - name = '%s.%s' % ( - obj.__class__.__module__, - obj.__class__.__name__ - ) + name = getattr(obj.__class__, '__qualname__', obj.__class__.__name__) + if obj.__class__.__module__ not in ('exceptions', 'builtins'): + name = '%s.%s' % (obj.__class__.__module__, name) step = len(name) + 1 p.begin_group(step, name + '(') for idx, arg in enumerate(getattr(obj, 'args', ())): diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/lib/tests/test_pretty.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/lib/tests/test_pretty.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/lib/tests/test_pretty.py 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/lib/tests/test_pretty.py 2014-04-21 23:54:26.000000000 +0000 @@ -45,6 +45,10 @@ def _repr_pretty_(self, p, cycle): p.text("MyDict(...)") +class MyObj(object): + def somemethod(self): + pass + class Dummy1(object): def _repr_pretty_(self, p, cycle): @@ -222,3 +226,6 @@ last2 = p.rsplit('\n', 2)[-2:] nt.assert_equal(last2, [' 999: 999,', ' ...}']) +def test_unbound_method(): + output = pretty.pretty(MyObj.somemethod) + nt.assert_in('MyObj.somemethod', output) \ No newline at end of file diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/nbconvert/exporters/exporter.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/nbconvert/exporters/exporter.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/nbconvert/exporters/exporter.py 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/nbconvert/exporters/exporter.py 2014-04-21 23:54:26.000000000 +0000 @@ -70,6 +70,7 @@ 'IPython.nbconvert.preprocessors.CSSHTMLHeaderPreprocessor', 'IPython.nbconvert.preprocessors.RevealHelpPreprocessor', 'IPython.nbconvert.preprocessors.LatexPreprocessor', + 'IPython.nbconvert.preprocessors.ClearOutputPreprocessor', 'IPython.nbconvert.preprocessors.HighlightMagicsPreprocessor'], config=True, help="""List of preprocessors available by default, by name, namespace, diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/nbconvert/nbconvertapp.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/nbconvert/nbconvertapp.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/nbconvert/nbconvertapp.py 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/nbconvert/nbconvertapp.py 2014-04-21 23:54:26.000000000 +0000 @@ -199,8 +199,8 @@ @catch_config_error def initialize(self, argv=None): - super(NbConvertApp, self).initialize(argv) self.init_syspath() + super(NbConvertApp, self).initialize(argv) self.init_notebooks() self.init_writer() self.init_postprocessor() diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/nbconvert/preprocessors/clearoutput.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/nbconvert/preprocessors/clearoutput.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/nbconvert/preprocessors/clearoutput.py 1970-01-01 00:00:00.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/nbconvert/preprocessors/clearoutput.py 2014-04-21 23:54:26.000000000 +0000 @@ -0,0 +1,27 @@ +"""Module containing a preprocessor that removes the outputs from code cells""" + +# Copyright (c) IPython Development Team. +# Distributed under the terms of the Modified BSD License. + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- + +from .base import Preprocessor + + +#----------------------------------------------------------------------------- +# Classes +#----------------------------------------------------------------------------- +class ClearOutputPreprocessor(Preprocessor): + """ + Removes the output from all code cells in a notebook. + """ + + def preprocess_cell(self, cell, resources, cell_index): + """ + Apply a transformation on each cell. See base.py for details. + """ + if cell.cell_type == 'code': + cell.outputs = [] + return cell, resources diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/nbconvert/preprocessors/__init__.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/nbconvert/preprocessors/__init__.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/nbconvert/preprocessors/__init__.py 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/nbconvert/preprocessors/__init__.py 2014-04-21 23:54:26.000000000 +0000 @@ -7,6 +7,7 @@ from .latex import LatexPreprocessor from .csshtmlheader import CSSHTMLHeaderPreprocessor from .highlightmagics import HighlightMagicsPreprocessor +from .clearoutput import ClearOutputPreprocessor # decorated function Preprocessors from .coalescestreams import coalesce_streams diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/nbconvert/preprocessors/tests/test_clearoutput.py ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/nbconvert/preprocessors/tests/test_clearoutput.py --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/nbconvert/preprocessors/tests/test_clearoutput.py 1970-01-01 00:00:00.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/nbconvert/preprocessors/tests/test_clearoutput.py 2014-04-21 23:54:26.000000000 +0000 @@ -0,0 +1,41 @@ +""" +Module with tests for the clearoutput preprocessor. +""" + +# Copyright (c) IPython Development Team. +# Distributed under the terms of the Modified BSD License. + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- +from IPython.nbformat import current as nbformat + +from .base import PreprocessorTestsBase +from ..clearoutput import ClearOutputPreprocessor + + +#----------------------------------------------------------------------------- +# Class +#----------------------------------------------------------------------------- + +class TestClearOutput(PreprocessorTestsBase): + """Contains test functions for clearoutput.py""" + + + def build_preprocessor(self): + """Make an instance of a preprocessor""" + preprocessor = ClearOutputPreprocessor() + preprocessor.enabled = True + return preprocessor + + def test_constructor(self): + """Can a ClearOutputPreprocessor be constructed?""" + self.build_preprocessor() + + def test_output(self): + """Test the output of the ClearOutputPreprocessor""" + nb = self.build_notebook() + res = self.build_resources() + preprocessor = self.build_preprocessor() + nb, res = preprocessor(nb, res) + assert nb.worksheets[0].cells[0].outputs == [] diff -Nru ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/nbconvert/templates/html/slides_reveal.tpl ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/nbconvert/templates/html/slides_reveal.tpl --- ipython-2.0.0+mirror1+r456+81~ubuntu12.04.1/IPython/nbconvert/templates/html/slides_reveal.tpl 2014-04-18 00:25:19.000000000 +0000 +++ ipython-2.0.0+mirror1+r468+81~ubuntu12.04.1/IPython/nbconvert/templates/html/slides_reveal.tpl 2014-04-21 23:54:26.000000000 +0000 @@ -55,9 +55,16 @@ - +