commit python2-jupyter_ipython for openSUSE:Factory
Hello community,
here is the log from the commit of package python2-jupyter_ipython for openSUSE:Factory checked in at 2018-05-29 10:39:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python2-jupyter_ipython (Old)
and /work/SRC/openSUSE:Factory/.python2-jupyter_ipython.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python2-jupyter_ipython"
Tue May 29 10:39:10 2018 rev:4 rq:611091 version:5.7.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python2-jupyter_ipython/python2-jupyter_ipython.changes 2018-02-21 14:13:12.818425093 +0100
+++ /work/SRC/openSUSE:Factory/.python2-jupyter_ipython.new/python2-jupyter_ipython.changes 2018-05-29 10:39:16.356998933 +0200
@@ -1,0 +2,18 @@
+Fri May 18 18:44:36 UTC 2018 - toddrme2178@gmail.com
+
+- Update to 5.7.0
+ * Fix IPython trying to import non-existing matplotlib backends :ghpull:`11087`
+ * fix for display hook not publishing object metadata :ghpull:`11101`
+- Update to 5.6.0
+ * In Python 3.6 and above, dictionaries preserve the order items were added to
+ them. On these versions, IPython will display dictionaries in their native
+ order, rather than sorting by the keys (:ghpull:`10958`).
+ * :class:`~.IPython.display.ProgressBar` can now be used as an iterator
+ (:ghpull:`10813`).
+ * The shell object gains a :meth:`~.InteractiveShell.check_complete` method,
+ to allow a smoother transition to new input processing machinery planned for
+ IPython 7 (:ghpull:`11044`).
+ * IPython should start faster, as it no longer looks for all available pygments
+ styles on startup (:ghpull:`10859`).
+
+-------------------------------------------------------------------
Old:
----
ipython-5.5.0.tar.gz
New:
----
ipython-5.7.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python2-jupyter_ipython.spec ++++++
--- /var/tmp/diff_new_pack.MGS25B/_old 2018-05-29 10:39:17.924941050 +0200
+++ /var/tmp/diff_new_pack.MGS25B/_new 2018-05-29 10:39:17.924941050 +0200
@@ -37,7 +37,7 @@
%endif
Name: python2-jupyter_ipython
-Version: 5.5.0
+Version: 5.7.0
Release: 0
Summary: Rich architecture for interactive computing with Python
License: BSD-3-Clause
@@ -74,6 +74,7 @@
Requires: python-backports.shutil_get_terminal_size
Requires: python-decorator
Requires: python-jedi >= 0.10
+Requires: python-pathlib2
Requires: python-pexpect
Requires: python-pickleshare
Requires: python-prompt_toolkit >= 1.0.4
@@ -253,8 +254,8 @@
fi
%files
-%defattr(-,root,root,-)
-%doc COPYING.rst README.rst docs/source/about/license_and_copyright.rst
+%doc README.rst
+%license COPYING.rst docs/source/about/license_and_copyright.rst
%{_bindir}/ipython
%{_bindir}/ipython2
%{_bindir}/ipython-%{py_ver}
@@ -274,7 +275,8 @@
%if %{with iptest}
%files iptest
-%defattr(-,root,root,-)
+%doc README.rst
+%license COPYING.rst docs/source/about/license_and_copyright.rst
%{_bindir}/iptest
%{_bindir}/iptest2
%{_bindir}/iptest-%{py_ver}
++++++ ipython-5.5.0.tar.gz -> ipython-5.7.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/core/crashhandler.py new/ipython-5.7.0/IPython/core/crashhandler.py
--- old/ipython-5.5.0/IPython/core/crashhandler.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/core/crashhandler.py 2018-05-10 20:47:30.000000000 +0200
@@ -54,6 +54,16 @@
If you want to do it now, the following command will work (under Unix):
mail -s '{app_name} Crash Report' {contact_email} < {crash_report_fname}
+In your email, please also include information about:
+- The operating system under which the crash happened: Linux, macOS, Windows,
+ other, and which exact version (for example: Ubuntu 16.04.3, macOS 10.13.2,
+ Windows 10 Pro), and whether it is 32-bit or 64-bit;
+- How {app_name} was installed: using pip or conda, from GitHub, as part of
+ a Docker container, or other, providing more detail if possible;
+- How to reproduce the crash: what exact sequence of instructions can one
+ input to get the same crash? Ideally, find a minimal yet complete sequence
+ of instructions that yields the crash.
+
To ensure accurate tracking of this issue, please file a report about it at:
{bug_tracker}
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/core/display.py new/ipython-5.7.0/IPython/core/display.py
--- old/ipython-5.5.0/IPython/core/display.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/core/display.py 2018-05-10 20:47:30.000000000 +0200
@@ -277,6 +277,13 @@
from IPython.display import display
"""
+ from IPython.core.interactiveshell import InteractiveShell
+
+ if not InteractiveShell.initialized():
+ # Directly print objects.
+ print(*objs)
+ return
+
raw = kwargs.pop('raw', False)
include = kwargs.pop('include', None)
exclude = kwargs.pop('exclude', None)
@@ -294,8 +301,6 @@
if transient:
kwargs['transient'] = transient
- from IPython.core.interactiveshell import InteractiveShell
-
if not raw:
format = InteractiveShell.instance().display_formatter.format
@@ -775,6 +780,23 @@
self._progress = value
self.update()
+ def __iter__(self):
+ self.display()
+ self._progress = -1 # First iteration is 0
+ return self
+
+ def __next__(self):
+ """Returns current value and increments display by one."""
+ self.progress += 1
+ if self.progress < self.total:
+ return self.progress
+ else:
+ raise StopIteration()
+
+ def next(self):
+ """Python 2 compatibility"""
+ return self.__next__()
+
class JSON(DisplayObject):
"""JSON expects a JSON-able dict or list
@@ -990,7 +1012,7 @@
if ext is not None:
if ext == u'jpg' or ext == u'jpeg':
format = self._FMT_JPEG
- if ext == u'png':
+ elif ext == u'png':
format = self._FMT_PNG
else:
format = ext.lower()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/core/displayhook.py new/ipython-5.7.0/IPython/core/displayhook.py
--- old/ipython-5.5.0/IPython/core/displayhook.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/core/displayhook.py 2018-05-10 20:47:30.000000000 +0200
@@ -306,4 +306,4 @@
if result is None:
return
format_dict, md_dict = self.shell.display_formatter.format(result)
- self.outputs.append((format_dict, md_dict))
+ self.outputs.append({ 'data': format_dict, 'metadata': md_dict })
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/core/displaypub.py new/ipython-5.7.0/IPython/core/displaypub.py
--- old/ipython-5.5.0/IPython/core/displaypub.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/core/displaypub.py 2018-05-10 20:46:06.000000000 +0200
@@ -121,11 +121,19 @@
"""A DisplayPublisher that stores"""
outputs = List()
- def publish(self, data, metadata=None, source=None):
- self.outputs.append((data, metadata))
-
+ def publish(self, data, metadata=None, source=None, **kwargs):
+
+ # These are kwargs only on Python 3, not used there.
+ # For consistency and avoid code divergence we leave them here to
+ # simplify potential backport
+ transient = kwargs.pop('transient', None)
+ update = kwargs.pop('update', False)
+
+ self.outputs.append({'data':data, 'metadata':metadata,
+ 'transient':transient, 'update':update})
+
def clear_output(self, wait=False):
super(CapturingDisplayPublisher, self).clear_output(wait)
-
+
# empty the list, *do not* reassign a new list
- del self.outputs[:]
+ self.outputs.clear()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/core/formatters.py new/ipython-5.7.0/IPython/core/formatters.py
--- old/ipython-5.5.0/IPython/core/formatters.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/core/formatters.py 2018-05-10 20:46:06.000000000 +0200
@@ -217,7 +217,7 @@
r = method(self, *args, **kwargs)
except NotImplementedError:
# don't warn on NotImplementedErrors
- return None
+ return self._check_return(None, args[0])
except Exception:
exc_info = sys.exc_info()
ip = get_ipython()
@@ -225,7 +225,7 @@
ip.showtraceback(exc_info)
else:
traceback.print_exception(*exc_info)
- return None
+ return self._check_return(None, args[0])
return self._check_return(r, args[0])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/core/history.py new/ipython-5.7.0/IPython/core/history.py
--- old/ipython-5.5.0/IPython/core/history.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/core/history.py 2018-05-10 20:47:30.000000000 +0200
@@ -21,7 +21,7 @@
from traitlets.config.configurable import LoggingConfigurable
from decorator import decorator
from IPython.utils.decorators import undoc
-from IPython.utils.path import locate_profile
+from IPython.paths import locate_profile
from IPython.utils import py3compat
from traitlets import (
Any, Bool, Dict, Instance, Integer, List, Unicode, TraitError,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/core/interactiveshell.py new/ipython-5.7.0/IPython/core/interactiveshell.py
--- old/ipython-5.5.0/IPython/core/interactiveshell.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/core/interactiveshell.py 2018-05-10 20:47:30.000000000 +0200
@@ -2626,6 +2626,8 @@
result.execution_count = self.execution_count
def error_before_exec(value):
+ if store_history:
+ self.execution_count += 1
result.error_before_exec = value
self.last_execution_succeeded = False
return result
@@ -2689,14 +2691,10 @@
return error_before_exec(e)
except IndentationError as e:
self.showindentationerror()
- if store_history:
- self.execution_count += 1
return error_before_exec(e)
except (OverflowError, SyntaxError, ValueError, TypeError,
MemoryError) as e:
self.showsyntaxerror()
- if store_history:
- self.execution_count += 1
return error_before_exec(e)
# Apply AST transformations
@@ -2704,8 +2702,6 @@
code_ast = self.transform_ast(code_ast)
except InputRejected as e:
self.showtraceback()
- if store_history:
- self.execution_count += 1
return error_before_exec(e)
# Give the displayhook a reference to our ExecutionResult so it
@@ -2904,6 +2900,26 @@
# For backwards compatibility
runcode = run_code
+ def check_complete(self, code):
+ """Return whether a block of code is ready to execute, or should be continued
+
+ Parameters
+ ----------
+ source : string
+ Python input code, which can be multiline.
+
+ Returns
+ -------
+ status : str
+ One of 'complete', 'incomplete', or 'invalid' if source is not a
+ prefix of valid code.
+ indent : str
+ When status is 'incomplete', this is some whitespace to insert on
+ the next line of the prompt.
+ """
+ status, nspaces = self.input_splitter.check_complete(code)
+ return status, ' ' * (nspaces or 0)
+
#-------------------------------------------------------------------------
# Things related to GUI support and pylab
#-------------------------------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/core/pylabtools.py new/ipython-5.7.0/IPython/core/pylabtools.py
--- old/ipython-5.5.0/IPython/core/pylabtools.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/core/pylabtools.py 2018-05-10 20:47:30.000000000 +0200
@@ -24,6 +24,9 @@
'nbagg': 'nbAgg',
'notebook': 'nbAgg',
'agg': 'agg',
+ 'svg': 'svg',
+ 'pdf': 'pdf',
+ 'ps': 'ps',
'inline': 'module://ipykernel.pylab.backend_inline',
'ipympl': 'module://ipympl.backend_nbagg',
'widget': 'module://ipympl.backend_nbagg',
@@ -45,6 +48,9 @@
# And some backends that don't need GUI integration
del backend2gui['nbAgg']
del backend2gui['agg']
+del backend2gui['svg']
+del backend2gui['pdf']
+del backend2gui['ps']
del backend2gui['module://ipykernel.pylab.backend_inline']
#-----------------------------------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/core/release.py new/ipython-5.7.0/IPython/core/release.py
--- old/ipython-5.5.0/IPython/core/release.py 2017-09-15 19:01:51.000000000 +0200
+++ new/ipython-5.7.0/IPython/core/release.py 2018-05-10 20:53:56.000000000 +0200
@@ -20,7 +20,7 @@
# release. 'dev' as a _version_extra string means this is a development
# version
_version_major = 5
-_version_minor = 5
+_version_minor = 7
_version_patch = 0
_version_extra = '.dev'
# _version_extra = 'rc1'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/core/tests/test_display.py new/ipython-5.7.0/IPython/core/tests/test_display.py
--- old/ipython-5.5.0/IPython/core/tests/test_display.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/core/tests/test_display.py 2018-05-10 20:46:06.000000000 +0200
@@ -10,6 +10,7 @@
from IPython.core import display
from IPython.core.getipython import get_ipython
+from IPython.utils.io import capture_output
from IPython.utils.tempdir import NamedFileInTemporaryDirectory
from IPython import paths as ipath
from IPython.testing.tools import AssertPrints, AssertNotPrints
@@ -167,11 +168,19 @@
def test_progress():
p = display.ProgressBar(10)
- nt.assert_true('0/10' in repr(p))
+ nt.assert_in('0/10',repr(p))
p.html_width = '100%'
p.progress = 5
nt.assert_equal(p._repr_html_(), "<progress style='width:100%' max='10' value='5'></progress>")
+def test_progress_iter():
+ with capture_output(display=False) as captured:
+ for i in display.ProgressBar(5):
+ out = captured.stdout
+ nt.assert_in('{0}/5'.format(i), out)
+ out = captured.stdout
+ nt.assert_in('5/5', out)
+
def test_json():
d = {'a': 5}
lis = [d]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/core/tests/test_displayhook.py new/ipython-5.7.0/IPython/core/tests/test_displayhook.py
--- old/ipython-5.5.0/IPython/core/tests/test_displayhook.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/core/tests/test_displayhook.py 2018-05-10 20:47:30.000000000 +0200
@@ -1,4 +1,7 @@
+import sys
from IPython.testing.tools import AssertPrints, AssertNotPrints
+from IPython.core.displayhook import CapturingDisplayHook
+from IPython.utils.capture import CapturedIO
ip = get_ipython()
@@ -26,3 +29,11 @@
with AssertNotPrints('2'):
ip.run_cell('1+1;\n#commented_out_function()', store_history=True)
+
+def test_capture_display_hook_format():
+ """Tests that the capture display hook conforms to the CapturedIO output format"""
+ hook = CapturingDisplayHook(ip)
+ hook({"foo": "bar"})
+ captured = CapturedIO(sys.stdout, sys.stderr, hook.outputs)
+ # Should not raise with RichOutput transformation error
+ captured.outputs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/core/tests/test_formatters.py new/ipython-5.7.0/IPython/core/tests/test_formatters.py
--- old/ipython-5.5.0/IPython/core/tests/test_formatters.py 2017-09-01 23:05:29.000000000 +0200
+++ new/ipython-5.7.0/IPython/core/tests/test_formatters.py 2018-05-10 20:47:30.000000000 +0200
@@ -49,7 +49,7 @@
f = PlainTextFormatter()
f.for_type(A, foo_printer)
nt.assert_equal(f(A()), 'foo')
- nt.assert_equal(f(B()), 'foo')
+ nt.assert_equal(f(B()), 'B()')
nt.assert_equal(f(GoodPretty()), 'foo')
# Just don't raise an exception for the following:
f(BadPretty())
@@ -521,3 +521,13 @@
'height': 10,
}
})
+
+def test_repr_mime_failure():
+ class BadReprMime(object):
+ def _repr_mimebundle_(self, include=None, exclude=None):
+ raise RuntimeError
+
+ f = get_ipython().display_formatter
+ obj = BadReprMime()
+ d, md = f.format(obj)
+ nt.assert_in('text/plain', d)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/core/tests/test_interactiveshell.py new/ipython-5.7.0/IPython/core/tests/test_interactiveshell.py
--- old/ipython-5.5.0/IPython/core/tests/test_interactiveshell.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/core/tests/test_interactiveshell.py 2018-05-10 20:47:30.000000000 +0200
@@ -948,3 +948,14 @@
with tt.AssertNotPrints("I AM A WARNING"):
ip.run_cell("wrn()")
ip.run_cell("del wrn")
+
+
+def test_custom_exc_count():
+ hook = mock.Mock(return_value=None)
+ ip.set_custom_exc((SyntaxError,), hook)
+ before = ip.execution_count
+ ip.run_cell("def foo()", store_history=True)
+ # restore default excepthook
+ ip.set_custom_exc((), None)
+ nt.assert_equal(hook.call_count, 1)
+ nt.assert_equal(ip.execution_count, before + 1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/core/tests/test_pylabtools.py new/ipython-5.7.0/IPython/core/tests/test_pylabtools.py
--- old/ipython-5.5.0/IPython/core/tests/test_pylabtools.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/core/tests/test_pylabtools.py 2018-05-10 20:47:30.000000000 +0200
@@ -106,7 +106,7 @@
f = formatter.lookup_by_type(Figure)
cell = f.__closure__[0].cell_contents
nt.assert_equal(cell, kwargs)
-
+
# check that the formatter doesn't raise
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
@@ -151,7 +151,7 @@
class Shell(InteractiveShell):
def enable_gui(self, gui):
pass
-
+
def setup(self):
import matplotlib
def act_mpl(backend):
@@ -245,3 +245,7 @@
nt.assert_equal(gui, 'qt')
nt.assert_equal(s.pylab_gui_select, 'qt')
+
+def test_no_gui_backends():
+ for k in ['agg', 'svg', 'pdf', 'ps']:
+ assert k not in pt.backend2gui
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/extensions/autoreload.py new/ipython-5.7.0/IPython/extensions/autoreload.py
--- old/ipython-5.5.0/IPython/extensions/autoreload.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/extensions/autoreload.py 2018-05-10 20:47:30.000000000 +0200
@@ -186,7 +186,7 @@
if not hasattr(module, '__file__') or module.__file__ is None:
return None, None
- if getattr(module, '__name__', None) in ['__mp_main__', '__main__']:
+ if getattr(module, '__name__', None) in [None, '__mp_main__', '__main__']:
# we cannot reload(__main__) or reload(__mp_main__)
return None, None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/lib/pretty.py new/ipython-5.7.0/IPython/lib/pretty.py
--- old/ipython-5.5.0/IPython/lib/pretty.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/lib/pretty.py 2018-05-10 20:47:30.000000000 +0200
@@ -96,6 +96,9 @@
MAX_SEQ_LENGTH = 1000
+# The language spec says that dicts preserve order from 3.7, but CPython
+# does so from 3.6, so it seems likely that people will expect that.
+DICT_IS_ORDERED = sys.version_info >= (3, 6)
_re_pattern_type = type(re.compile(''))
def _safe_getattr(obj, attr, default=None):
@@ -395,6 +398,10 @@
meth = cls._repr_pretty_
if callable(meth):
return meth(obj, self, cycle)
+ if cls is not object \
+ and callable(cls.__dict__.get('__repr__')):
+ return _repr_pprint(obj, self, cycle)
+
return _default_pprint(obj, self, cycle)
finally:
self.end_group()
@@ -545,17 +552,12 @@
p.end_group(1, '>')
-def _seq_pprinter_factory(start, end, basetype):
+def _seq_pprinter_factory(start, end):
"""
Factory that returns a pprint function useful for sequences. Used by
the default pprint for tuples, dicts, and lists.
"""
def inner(obj, p, cycle):
- typ = type(obj)
- if basetype is not None and typ is not basetype and typ.__repr__ != basetype.__repr__:
- # If the subclass provides its own repr, use it instead.
- return p.text(typ.__repr__(obj))
-
if cycle:
return p.text(start + '...' + end)
step = len(start)
@@ -572,21 +574,16 @@
return inner
-def _set_pprinter_factory(start, end, basetype):
+def _set_pprinter_factory(start, end):
"""
Factory that returns a pprint function useful for sets and frozensets.
"""
def inner(obj, p, cycle):
- typ = type(obj)
- if basetype is not None and typ is not basetype and typ.__repr__ != basetype.__repr__:
- # If the subclass provides its own repr, use it instead.
- return p.text(typ.__repr__(obj))
-
if cycle:
return p.text(start + '...' + end)
if len(obj) == 0:
# Special case.
- p.text(basetype.__name__ + '()')
+ p.text(type(obj).__name__ + '()')
else:
step = len(start)
p.begin_group(step, start)
@@ -604,24 +601,21 @@
return inner
-def _dict_pprinter_factory(start, end, basetype=None):
+def _dict_pprinter_factory(start, end):
"""
Factory that returns a pprint function used by the default pprint of
dicts and dict proxies.
"""
def inner(obj, p, cycle):
- typ = type(obj)
- if basetype is not None and typ is not basetype and typ.__repr__ != basetype.__repr__:
- # If the subclass provides its own repr, use it instead.
- return p.text(typ.__repr__(obj))
-
if cycle:
return p.text('{...}')
step = len(start)
p.begin_group(step, start)
keys = obj.keys()
# if dict isn't large enough to be truncated, sort keys before displaying
- if not (p.max_seq_length and len(obj) >= p.max_seq_length):
+ # From Python 3.7, dicts preserve order by definition, so we don't sort.
+ if not DICT_IS_ORDERED \
+ and not (p.max_seq_length and len(obj) >= p.max_seq_length):
keys = _sorted_for_pprint(keys)
for idx, key in p._enumerate(keys):
if idx:
@@ -749,12 +743,12 @@
int: _repr_pprint,
float: _repr_pprint,
str: _repr_pprint,
- tuple: _seq_pprinter_factory('(', ')', tuple),
- list: _seq_pprinter_factory('[', ']', list),
- dict: _dict_pprinter_factory('{', '}', dict),
+ tuple: _seq_pprinter_factory('(', ')'),
+ list: _seq_pprinter_factory('[', ']'),
+ dict: _dict_pprinter_factory('{', '}'),
- set: _set_pprinter_factory('{', '}', set),
- frozenset: _set_pprinter_factory('frozenset({', '})', frozenset),
+ set: _set_pprinter_factory('{', '}'),
+ frozenset: _set_pprinter_factory('frozenset({', '})'),
super: _super_pprint,
_re_pattern_type: _re_pattern_pprint,
type: _type_pprint,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/lib/tests/test_pretty.py new/ipython-5.7.0/IPython/lib/tests/test_pretty.py
--- old/ipython-5.5.0/IPython/lib/tests/test_pretty.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/lib/tests/test_pretty.py 2018-05-10 20:47:30.000000000 +0200
@@ -534,3 +534,23 @@
nt.assert_equal(pretty.pretty(obj), expected)
nt.assert_equal(pretty.pretty(underlying_dict),
"{-3: {...}, 0: dict_proxy({-3: {...}, 0: {...}})}")
+
+class OrderedCounter(Counter, OrderedDict):
+ 'Counter that remembers the order elements are first encountered'
+
+ def __repr__(self):
+ return '%s(%r)' % (self.__class__.__name__, OrderedDict(self))
+
+ def __reduce__(self):
+ return self.__class__, (OrderedDict(self),)
+
+class MySet(set): # Override repr of a basic type
+ def __repr__(self):
+ return 'mine'
+
+def test_custom_repr():
+ """A custom repr should override a pretty printer for a parent type"""
+ oc = OrderedCounter("abracadabra")
+ nt.assert_in("OrderedCounter(OrderedDict", pretty.pretty(oc))
+
+ nt.assert_equal(pretty.pretty(MySet()), 'mine')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/sphinxext/ipython_directive.py new/ipython-5.7.0/IPython/sphinxext/ipython_directive.py
--- old/ipython-5.5.0/IPython/sphinxext/ipython_directive.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/sphinxext/ipython_directive.py 2018-05-10 20:47:30.000000000 +0200
@@ -104,8 +104,8 @@
In [1]: 1/0
In [2]: # raise warning.
-ToDo
-----
+To Do
+-----
- Turn the ad-hoc test() function into a real test suite.
- Break up ipython-specific functionality from matplotlib stuff into better
@@ -295,14 +295,6 @@
IP = InteractiveShell.instance(config=config, profile_dir=profile)
atexit.register(self.cleanup)
- sys.stdout = self.cout
- sys.stderr = self.cout
-
- # For debugging, so we can see normal output, use this:
- #from IPython.utils.io import Tee
- #sys.stdout = Tee(self.cout, channel='stdout') # dbg
- #sys.stderr = Tee(self.cout, channel='stderr') # dbg
-
# Store a few parts of IPython we'll need.
self.IP = IP
self.user_ns = self.IP.user_ns
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/terminal/interactiveshell.py new/ipython-5.7.0/IPython/terminal/interactiveshell.py
--- old/ipython-5.5.0/IPython/terminal/interactiveshell.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/terminal/interactiveshell.py 2018-05-10 20:46:06.000000000 +0200
@@ -23,7 +23,7 @@
from prompt_toolkit.layout.processors import ConditionalProcessor, HighlightMatchingBracketProcessor
from prompt_toolkit.styles import PygmentsStyle, DynamicStyle
-from pygments.styles import get_style_by_name, get_all_styles
+from pygments.styles import get_style_by_name
from pygments.style import Style
from pygments.token import Token
@@ -134,9 +134,11 @@
help="Enable mouse support in the prompt"
).tag(config=True)
+ # We don't load the list of styles for the help string, because loading
+ # Pygments plugins takes time and can cause unexpected errors.
highlighting_style = Union([Unicode('legacy'), Type(klass=Style)],
help="""The name or class of a Pygments style to use for syntax
- highlighting: \n %s""" % ', '.join(get_all_styles())
+ highlighting. To see available styles, run `pygmentize -L styles`."""
).tag(config=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/utils/_sysinfo.py new/ipython-5.7.0/IPython/utils/_sysinfo.py
--- old/ipython-5.5.0/IPython/utils/_sysinfo.py 2017-09-15 19:02:18.000000000 +0200
+++ new/ipython-5.7.0/IPython/utils/_sysinfo.py 2018-05-10 20:54:38.000000000 +0200
@@ -1,2 +1,2 @@
# GENERATED BY setup.py
-commit = u"b467d487e"
+commit = u"a0d6ad545"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/IPython/utils/capture.py new/ipython-5.7.0/IPython/utils/capture.py
--- old/ipython-5.5.0/IPython/utils/capture.py 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/IPython/utils/capture.py 2018-05-10 20:46:06.000000000 +0200
@@ -21,14 +21,17 @@
class RichOutput(object):
- def __init__(self, data=None, metadata=None):
+ def __init__(self, data=None, metadata=None, transient=None, update=False):
self.data = data or {}
self.metadata = metadata or {}
-
+ self.transient = transient or {}
+ self.update = update
+
def display(self):
from IPython.display import publish_display_data
- publish_display_data(data=self.data, metadata=self.metadata)
-
+ publish_display_data(data=self.data, metadata=self.metadata,
+ transient=self.transient, update=self.update)
+
def _repr_mime_(self, mime):
if mime not in self.data:
return
@@ -40,22 +43,22 @@
def _repr_html_(self):
return self._repr_mime_("text/html")
-
+
def _repr_latex_(self):
return self._repr_mime_("text/latex")
-
+
def _repr_json_(self):
return self._repr_mime_("application/json")
-
+
def _repr_javascript_(self):
return self._repr_mime_("application/javascript")
-
+
def _repr_png_(self):
return self._repr_mime_("image/png")
-
+
def _repr_jpeg_(self):
return self._repr_mime_("image/jpeg")
-
+
def _repr_svg_(self):
return self._repr_mime_("image/svg+xml")
@@ -72,35 +75,35 @@
Additionally, there's a ``c.show()`` method which will print all of the
above in the same order, and can be invoked simply via ``c()``.
"""
-
+
def __init__(self, stdout, stderr, outputs=None):
self._stdout = stdout
self._stderr = stderr
if outputs is None:
outputs = []
self._outputs = outputs
-
+
def __str__(self):
return self.stdout
-
+
@property
def stdout(self):
"Captured standard output"
if not self._stdout:
return ''
return self._stdout.getvalue()
-
+
@property
def stderr(self):
"Captured standard error"
if not self._stderr:
return ''
return self._stderr.getvalue()
-
+
@property
def outputs(self):
"""A list of the captured rich display outputs, if any.
-
+
If you have a CapturedIO object ``c``, these can be displayed in IPython
using::
@@ -108,17 +111,17 @@
for o in c.outputs:
display(o)
"""
- return [ RichOutput(d, md) for d, md in self._outputs ]
-
+ return [ RichOutput(**kargs) for kargs in self._outputs ]
+
def show(self):
"""write my output to sys.stdout/err as appropriate"""
sys.stdout.write(self.stdout)
sys.stderr.write(self.stderr)
sys.stdout.flush()
sys.stderr.flush()
- for data, metadata in self._outputs:
- RichOutput(data, metadata).display()
-
+ for kargs in self._outputs:
+ RichOutput(**kargs).display()
+
__call__ = show
@@ -127,27 +130,27 @@
stdout = True
stderr = True
display = True
-
+
def __init__(self, stdout=True, stderr=True, display=True):
self.stdout = stdout
self.stderr = stderr
self.display = display
self.shell = None
-
+
def __enter__(self):
from IPython.core.getipython import get_ipython
from IPython.core.displaypub import CapturingDisplayPublisher
from IPython.core.displayhook import CapturingDisplayHook
-
+
self.sys_stdout = sys.stdout
self.sys_stderr = sys.stderr
-
+
if self.display:
self.shell = get_ipython()
if self.shell is None:
self.save_display_pub = None
self.display = False
-
+
stdout = stderr = outputs = None
if self.stdout:
stdout = sys.stdout = StringIO()
@@ -160,9 +163,9 @@
self.save_display_hook = sys.displayhook
sys.displayhook = CapturingDisplayHook(shell=self.shell,
outputs=outputs)
-
+
return CapturedIO(stdout, stderr, outputs)
-
+
def __exit__(self, exc_type, exc_value, traceback):
sys.stdout = self.sys_stdout
sys.stderr = self.sys_stderr
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/PKG-INFO new/ipython-5.7.0/PKG-INFO
--- old/ipython-5.5.0/PKG-INFO 2017-09-15 19:02:18.000000000 +0200
+++ new/ipython-5.7.0/PKG-INFO 2018-05-10 20:54:38.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: ipython
-Version: 5.5.0
+Version: 5.7.0
Summary: IPython: Productive Interactive Computing
Home-page: https://ipython.org
Author: The IPython Development Team
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/docs/source/index.rst new/ipython-5.7.0/docs/source/index.rst
--- old/ipython-5.5.0/docs/source/index.rst 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/docs/source/index.rst 2018-05-10 20:46:06.000000000 +0200
@@ -93,6 +93,7 @@
development/index
coredev/index
api/index
+ sphinxext
about/index
.. seealso::
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/docs/source/sphinxext.rst new/ipython-5.7.0/docs/source/sphinxext.rst
--- old/ipython-5.5.0/docs/source/sphinxext.rst 1970-01-01 01:00:00.000000000 +0100
+++ new/ipython-5.7.0/docs/source/sphinxext.rst 2018-04-03 17:49:40.000000000 +0200
@@ -0,0 +1,8 @@
+========================
+IPython Sphinx extension
+========================
+
+IPython provides an extension for `Sphinx http://www.sphinx-doc.org/`_ to
+highlight and run code.
+
+.. automodule:: IPython.sphinxext.ipython_directive
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/docs/source/whatsnew/github-stats-5.rst new/ipython-5.7.0/docs/source/whatsnew/github-stats-5.rst
--- old/ipython-5.5.0/docs/source/whatsnew/github-stats-5.rst 2017-09-15 18:56:35.000000000 +0200
+++ new/ipython-5.7.0/docs/source/whatsnew/github-stats-5.rst 2018-05-10 20:47:30.000000000 +0200
@@ -3,6 +3,29 @@
Issues closed in the 5.x development cycle
==========================================
+Issues closed in 5.6
+--------------------
+
+GitHub stats for 2017/09/15 - 2018/04/02 (tag: 5.5.0)
+
+These lists are automatically generated, and may be incomplete or contain duplicates.
+
+We closed 2 issues and merged 28 pull requests.
+The full list can be seen `on GitHub https://github.com/ipython/ipython/issues?q=milestone%3A5.6`__
+
+The following 10 authors contributed 47 commits.
+
+* Benjamin Ragan-Kelley
+* Henry Fredrick Schreiner
+* Joris Van den Bossche
+* Matthias Bussonnier
+* Mradul Dubey
+* Roshan Rao
+* Samuel Lelièvre
+* Teddy Rendahl
+* Thomas A Caswell
+* Thomas Kluyver
+
Issues closed in 5.5
--------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipython-5.5.0/docs/source/whatsnew/version5.rst new/ipython-5.7.0/docs/source/whatsnew/version5.rst
--- old/ipython-5.5.0/docs/source/whatsnew/version5.rst 2017-09-15 18:53:04.000000000 +0200
+++ new/ipython-5.7.0/docs/source/whatsnew/version5.rst 2018-05-10 20:47:30.000000000 +0200
@@ -2,11 +2,35 @@
5.x Series
============
-IPython 5.4.1
-=============
-Released a few hours after 5.4, fix a crash when
-``backports.shutil-get-terminal-size`` is not installed. :ghissue:`10629`
+.. _whatsnew570:
+
+IPython 5.7
+===========
+
+* Fix IPython trying to import non-existing matplotlib backends :ghpull:`11087`
+* fix for display hook not publishing object metadata :ghpull:`11101`
+
+.. _whatsnew560:
+
+IPython 5.6
+===========
+
+* In Python 3.6 and above, dictionaries preserve the order items were added to
+ them. On these versions, IPython will display dictionaries in their native
+ order, rather than sorting by the keys (:ghpull:`10958`).
+* :class:`~.IPython.display.ProgressBar` can now be used as an iterator
+ (:ghpull:`10813`).
+* The shell object gains a :meth:`~.InteractiveShell.check_complete` method,
+ to allow a smoother transition to new input processing machinery planned for
+ IPython 7 (:ghpull:`11044`).
+* IPython should start faster, as it no longer looks for all available pygments
+ styles on startup (:ghpull:`10859`).
+
+You can see all the PR marked for the `5.6. milestone https://github.com/ipython/ipython/pulls?utf8=%E2%9C%93&q=is%3Apr+milestone%3A5.6+is%3Aclosed+NOT+%22Backport+PR%22+`_,
+and all the `backport versions https://github.com/ipython/ipython/pulls?utf8=%E2%9C%93&q=is%3Apr%20milestone%3A5.6%20is%3Aclosed%20%22Backport%20PR%22%20`__.
+
+.. _whatsnew550:
IPython 5.5
===========
@@ -56,9 +80,12 @@
You can see all the PR marked for the `5.5. milestone https://github.com/ipython/ipython/pulls?q=is%3Apr%20milestone%3A5.5%20is%3A...`_,
and all the `backport versions https://github.com/ipython/ipython/pulls?utf8=%E2%9C%93&q=is%3Apr%20milestone%3A5.5%20is%3Aclosed%20%22Backport%20PR%22%20`_.
+IPython 5.4.1
+=============
+Released a few hours after 5.4, fix a crash when
+``backports.shutil-get-terminal-size`` is not installed. :ghissue:`10629`
-
-
+.. _whatsnew540:
IPython 5.4
===========
@@ -410,5 +437,3 @@
- Color styles might not adapt to terminal emulator themes. This will need new
version of Pygments to be released, and can be mitigated with custom themes.
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' "old/ipython-5.5.0/examples/IPython Kernel/Updating Displays.ipynb" "new/ipython-5.7.0/examples/IPython Kernel/Updating Displays.ipynb"
--- "old/ipython-5.5.0/examples/IPython Kernel/Updating Displays.ipynb" 2017-09-15 18:42:41.000000000 +0200
+++ "new/ipython-5.7.0/examples/IPython Kernel/Updating Displays.ipynb" 2018-04-03 17:49:40.000000000 +0200
@@ -21,10 +21,8 @@
},
{
"cell_type": "code",
- "execution_count": 10,
- "metadata": {
- "collapsed": true
- },
+ "execution_count": 1,
+ "metadata": {},
"outputs": [],
"source": [
"from IPython.display import display, update_display"
@@ -32,7 +30,7 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 2,
"metadata": {},
"outputs": [
{
@@ -50,7 +48,7 @@
"<DisplayHandle display_id=update-me>"
]
},
- "execution_count": 13,
+ "execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
@@ -70,7 +68,7 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 3,
"metadata": {},
"outputs": [
{
@@ -97,10 +95,8 @@
},
{
"cell_type": "code",
- "execution_count": 15,
- "metadata": {
- "collapsed": true
- },
+ "execution_count": 4,
+ "metadata": {},
"outputs": [],
"source": [
"handle.update('z')"
@@ -116,7 +112,7 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": 5,
"metadata": {},
"outputs": [
{
@@ -131,10 +127,10 @@
{
"data": {
"text/plain": [
- "<DisplayHandle display_id=07fc47b2ef652ccb70addeee3eb0981a>"
+ "<DisplayHandle display_id=118a56127f42348f8893440da7181c57>"
]
},
- "execution_count": 16,
+ "execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
@@ -154,7 +150,7 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 6,
"metadata": {},
"outputs": [
{
@@ -173,7 +169,7 @@
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": 7,
"metadata": {},
"outputs": [
{
@@ -200,10 +196,8 @@
},
{
"cell_type": "code",
- "execution_count": 19,
- "metadata": {
- "collapsed": true
- },
+ "execution_count": 8,
+ "metadata": {},
"outputs": [],
"source": [
"update_display('z', display_id='here')"
@@ -222,16 +216,16 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
- "<progress style='width:100%' max='10' value='10'></progress>"
+ "<progress style='width:60ex' max='10' value='10'></progress>"
],
"text/plain": [
- "
participants (1)
-
root@hilbert.suse.de