diff -Nru ipykernel-4.8.2/appveyor.yml ipykernel-4.9.0/appveyor.yml --- ipykernel-4.8.2/appveyor.yml 2018-02-19 16:18:33.000000000 +0000 +++ ipykernel-4.9.0/appveyor.yml 2018-08-29 18:42:32.000000000 +0000 @@ -18,7 +18,7 @@ - cmd: set PATH=%python%;%python%\scripts;%PATH% install: - cmd: | - pip install --upgrade pip wheel + python -m pip install --upgrade pip wheel pip --version - cmd: | pip install --pre -e . diff -Nru ipykernel-4.8.2/debian/changelog ipykernel-4.9.0/debian/changelog --- ipykernel-4.8.2/debian/changelog 2018-02-23 21:16:57.000000000 +0000 +++ ipykernel-4.9.0/debian/changelog 2018-09-04 05:23:45.000000000 +0000 @@ -1,3 +1,20 @@ +ipykernel (4.9.0-1) unstable; urgency=medium + + [ Ondřej Nový ] + * d/control: Remove ancient X-Python-Version field + * d/control: Remove ancient X-Python3-Version field + * Convert git repository from git-dpm to gbp layout + + [ Julien Puydt ] + * New upstream release. + * Refresh packaging: + - Use my debian.org mail address. + - Update dates in d/copyright. + - Bump dh compat to 11. + - Bump std-ver to 4.2.1. + + -- Julien Puydt Tue, 04 Sep 2018 07:23:45 +0200 + ipykernel (4.8.2-2) unstable; urgency=medium * Unbreak autopkgtest by restricting where tests are found. diff -Nru ipykernel-4.8.2/debian/compat ipykernel-4.9.0/debian/compat --- ipykernel-4.8.2/debian/compat 2018-02-23 21:16:57.000000000 +0000 +++ ipykernel-4.9.0/debian/compat 2018-09-04 05:23:45.000000000 +0000 @@ -1 +1 @@ -10 +11 diff -Nru ipykernel-4.8.2/debian/control ipykernel-4.9.0/debian/control --- ipykernel-4.8.2/debian/control 2018-02-23 21:16:57.000000000 +0000 +++ ipykernel-4.9.0/debian/control 2018-09-04 05:23:45.000000000 +0000 @@ -1,12 +1,12 @@ Source: ipykernel -Uploaders: Julien Puydt , +Uploaders: Julien Puydt , Gordon Ball Maintainer: Debian Python Modules Team Section: python Priority: optional -Standards-Version: 4.1.3 +Standards-Version: 4.2.1 Homepage: https://github.com/ipython/ipykernel -Build-Depends: debhelper (>= 10), +Build-Depends: debhelper (>= 11), dh-python, python, python-faulthandler (>= 2.4), @@ -31,8 +31,6 @@ python3-setuptools, python3-tornado, python3-traitlets -X-Python-Version: >= 2.7 -X-Python3-Version: >= 3.3 Vcs-Git: https://salsa.debian.org/python-team/modules/ipykernel.git Vcs-Browser: https://salsa.debian.org/python-team/modules/ipykernel diff -Nru ipykernel-4.8.2/debian/copyright ipykernel-4.9.0/debian/copyright --- ipykernel-4.8.2/debian/copyright 2018-02-23 21:16:57.000000000 +0000 +++ ipykernel-4.9.0/debian/copyright 2018-09-04 05:23:45.000000000 +0000 @@ -2,11 +2,11 @@ Upstream-Name: ipykernel Files: * -Copyright: 2015-2017 Jupyter Development Team +Copyright: 2015-2018 Jupyter Development Team License: BSD-3-clause Files: debian/* -Copyright: 2015-2017 Julien Puydt +Copyright: 2015-2018 Julien Puydt 2016-2017 Gordon Ball 2016 David Douard License: BSD-3-clause diff -Nru ipykernel-4.8.2/debian/.git-dpm ipykernel-4.9.0/debian/.git-dpm --- ipykernel-4.8.2/debian/.git-dpm 2018-02-23 21:16:57.000000000 +0000 +++ ipykernel-4.9.0/debian/.git-dpm 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -# see git-dpm(1) from git-dpm package -a9cef4b6369f3ea1cc99695032e841c00f489e10 -a9cef4b6369f3ea1cc99695032e841c00f489e10 -669a5bd37c9d020646d02a2d3eb0a88c74758f2d -669a5bd37c9d020646d02a2d3eb0a88c74758f2d -ipykernel_4.8.0.orig.tar.gz -d5ceb0861025f95150cfa843e21012b8c9babc4b -97632 -debianTag="debian/%e%v" -patchedTag="patched/%e%v" -upstreamTag="upstream/%e%u" diff -Nru ipykernel-4.8.2/debian/patches/0001-use-setuptools-for-everything-so-python-Depends-subs.patch ipykernel-4.9.0/debian/patches/0001-use-setuptools-for-everything-so-python-Depends-subs.patch --- ipykernel-4.8.2/debian/patches/0001-use-setuptools-for-everything-so-python-Depends-subs.patch 2018-02-23 21:16:57.000000000 +0000 +++ ipykernel-4.9.0/debian/patches/0001-use-setuptools-for-everything-so-python-Depends-subs.patch 2018-09-04 05:23:45.000000000 +0000 @@ -1,4 +1,4 @@ -From f4db5b7f3aa57c19c925324e78404a193aecb4d2 Mon Sep 17 00:00:00 2001 +From 4cebc2bdf5cd27e7d8253f4f4f7397d30b481b4c Mon Sep 17 00:00:00 2001 From: Julien Puydt Date: Tue, 6 Oct 2015 07:58:09 +0200 Subject: use setuptools for everything so python*:Depends substitutions work @@ -9,7 +9,7 @@ 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py -index 4b38885..1935cfb 100644 +index de0561a..8f2f04b 100644 --- a/setup.py +++ b/setup.py @@ -76,8 +76,7 @@ setup_args = dict( diff -Nru ipykernel-4.8.2/debian/patches/0002-test_simple_print-may-produce-stderr-content-when-ex.patch ipykernel-4.9.0/debian/patches/0002-test_simple_print-may-produce-stderr-content-when-ex.patch --- ipykernel-4.8.2/debian/patches/0002-test_simple_print-may-produce-stderr-content-when-ex.patch 2018-02-23 21:16:57.000000000 +0000 +++ ipykernel-4.9.0/debian/patches/0002-test_simple_print-may-produce-stderr-content-when-ex.patch 2018-09-04 05:23:45.000000000 +0000 @@ -1,4 +1,4 @@ -From fc5b42fc810f8c66568520b992dd8766f7c4ee4b Mon Sep 17 00:00:00 2001 +From ad6b1d3d99b4e24ab05dff6ec02d3f54bb67b7e6 Mon Sep 17 00:00:00 2001 From: David Douard Date: Fri, 8 Apr 2016 16:52:26 +0200 Subject: test_simple_print may produce stderr content when executed in sbuild diff -Nru ipykernel-4.8.2/debian/patches/0003-Made-build-reproducible-patch-by-Daniel-Shahaf.patch ipykernel-4.9.0/debian/patches/0003-Made-build-reproducible-patch-by-Daniel-Shahaf.patch --- ipykernel-4.8.2/debian/patches/0003-Made-build-reproducible-patch-by-Daniel-Shahaf.patch 2018-02-23 21:16:57.000000000 +0000 +++ ipykernel-4.9.0/debian/patches/0003-Made-build-reproducible-patch-by-Daniel-Shahaf.patch 2018-09-04 05:23:45.000000000 +0000 @@ -1,4 +1,4 @@ -From a9cef4b6369f3ea1cc99695032e841c00f489e10 Mon Sep 17 00:00:00 2001 +From 76e958a7198d73d0f4cce3abb07d201abb3090cd Mon Sep 17 00:00:00 2001 From: Julien Puydt Date: Sun, 2 Oct 2016 14:32:58 +0200 Subject: Made build reproducible -- patch by Daniel Shahaf diff -Nru ipykernel-4.8.2/docs/changelog.rst ipykernel-4.9.0/docs/changelog.rst --- ipykernel-4.8.2/docs/changelog.rst 2018-02-19 16:18:33.000000000 +0000 +++ ipykernel-4.9.0/docs/changelog.rst 2018-08-29 18:42:32.000000000 +0000 @@ -1,6 +1,21 @@ Changes in IPython kernel ========================= +4.9 +--- + +4.9.0 +***** + +`4.9.0 on GitHub `__ + +- Python 3.3 is no longer supported (:ghpull:`336`) +- Flush stdout/stderr in KernelApp before replacing (:ghpull:`314`) +- Allow preserving stdout and stderr in KernelApp (:ghpull:`315`) +- Override writable method on OutStream (:ghpull:`316`) +- Add metadata to help display matplotlib figures legibly (:ghpull:`336`) + + 4.8 --- diff -Nru ipykernel-4.8.2/.gitignore ipykernel-4.9.0/.gitignore --- ipykernel-4.8.2/.gitignore 2018-02-19 16:18:33.000000000 +0000 +++ ipykernel-4.9.0/.gitignore 2018-08-29 18:42:32.000000000 +0000 @@ -23,3 +23,4 @@ .coverage data_kernelspec +.pytest_cache diff -Nru ipykernel-4.8.2/ipykernel/comm/manager.py ipykernel-4.9.0/ipykernel/comm/manager.py --- ipykernel-4.8.2/ipykernel/comm/manager.py 2018-02-19 16:18:33.000000000 +0000 +++ ipykernel-4.9.0/ipykernel/comm/manager.py 2018-08-29 18:42:32.000000000 +0000 @@ -66,7 +66,7 @@ try: return self.comms[comm_id] except KeyError: - self.log.warn("No such comm: %s", comm_id) + self.log.warning("No such comm: %s", comm_id) if self.log.isEnabledFor(logging.DEBUG): # don't create the list of keys if debug messages aren't enabled self.log.debug("Current comms: %s", list(self.comms.keys())) diff -Nru ipykernel-4.8.2/ipykernel/iostream.py ipykernel-4.9.0/ipykernel/iostream.py --- ipykernel-4.8.2/ipykernel/iostream.py 2018-02-19 16:18:33.000000000 +0000 +++ ipykernel-4.9.0/ipykernel/iostream.py 2018-08-29 18:42:32.000000000 +0000 @@ -276,7 +276,7 @@ topic = None encoding = 'UTF-8' - def __init__(self, session, pub_thread, name, pipe=None): + def __init__(self, session, pub_thread, name, pipe=None, echo=None): if pipe is not None: warnings.warn("pipe argument to OutStream is deprecated and ignored", DeprecationWarning) @@ -296,6 +296,13 @@ self._flush_pending = False self._io_loop = pub_thread.io_loop self._new_buffer() + self.echo = None + + if echo: + if hasattr(echo, 'read') and hasattr(echo, 'write'): + self.echo = echo + else: + raise ValueError("echo argument must be a file like object") def _is_master_process(self): return os.getpid() == self._master_pid @@ -353,6 +360,15 @@ unless the thread has been destroyed (e.g. forked subprocess). """ self._flush_pending = False + + if self.echo is not None: + try: + self.echo.flush() + except OSError as e: + if self.echo is not sys.__stderr__: + print("Flush failed: {}".format(e), + file=sys.__stderr__) + data = self._flush_buffer() if data: # FIXME: this disables Session's fork-safe check, @@ -364,6 +380,14 @@ parent=self.parent_header, ident=self.topic) def write(self, string): + if self.echo is not None: + try: + self.echo.write(string) + except OSError as e: + if self.echo is not sys.__stderr__: + print("Write failed: {}".format(e), + file=sys.__stderr__) + if self.pub_thread is None: raise ValueError('I/O operation on closed file') else: @@ -390,6 +414,9 @@ for string in sequence: self.write(string) + def writable(self): + return True + def _flush_buffer(self): """clear the current buffer and return the current buffer data. diff -Nru ipykernel-4.8.2/ipykernel/kernelapp.py ipykernel-4.9.0/ipykernel/kernelapp.py --- ipykernel-4.8.2/ipykernel/kernelapp.py 2018-02-19 16:18:33.000000000 +0000 +++ ipykernel-4.9.0/ipykernel/kernelapp.py 2018-08-29 18:42:32.000000000 +0000 @@ -139,6 +139,7 @@ # streams, etc. no_stdout = Bool(False, help="redirect stdout to the null device").tag(config=True) no_stderr = Bool(False, help="redirect stderr to the null device").tag(config=True) + quiet = Bool(True, help="Only send stdout/stderr to output stream").tag(config=True) outstream_class = DottedObjectName('ipykernel.iostream.OutStream', help="The importstring for the OutStream factory").tag(config=True) displayhook_class = DottedObjectName('ipykernel.displayhook.ZMQDisplayHook', @@ -322,8 +323,18 @@ """Redirect input streams and set a display hook.""" if self.outstream_class: outstream_factory = import_item(str(self.outstream_class)) - sys.stdout = outstream_factory(self.session, self.iopub_thread, u'stdout') - sys.stderr = outstream_factory(self.session, self.iopub_thread, u'stderr') + sys.stdout.flush() + + e_stdout = None if self.quiet else sys.__stdout__ + e_stderr = None if self.quiet else sys.__stderr__ + + sys.stdout = outstream_factory(self.session, self.iopub_thread, + u'stdout', + echo=e_stdout) + sys.stderr.flush() + sys.stderr = outstream_factory(self.session, self.iopub_thread, + u'stderr', + echo=e_stderr) if self.displayhook_class: displayhook_factory = import_item(str(self.displayhook_class)) self.displayhook = displayhook_factory(self.session, self.iopub_socket) diff -Nru ipykernel-4.8.2/ipykernel/kernelbase.py ipykernel-4.9.0/ipykernel/kernelbase.py --- ipykernel-4.8.2/ipykernel/kernelbase.py 2018-02-19 16:18:33.000000000 +0000 +++ ipykernel-4.9.0/ipykernel/kernelbase.py 2018-08-29 18:42:32.000000000 +0000 @@ -225,7 +225,7 @@ handler = self.shell_handlers.get(msg_type, None) if handler is None: - self.log.warn("Unknown message type: %r", msg_type) + self.log.warning("Unknown message type: %r", msg_type) else: self.log.debug("%s: %s", msg_type, msg) self.pre_handler_hook() @@ -563,7 +563,7 @@ #--------------------------------------------------------------------------- def apply_request(self, stream, ident, parent): - self.log.warn("""apply_request is deprecated in kernel_base, moving to ipyparallel.""") + self.log.warning("apply_request is deprecated in kernel_base, moving to ipyparallel.") try: content = parent[u'content'] bufs = parent[u'buffers'] @@ -595,7 +595,7 @@ def abort_request(self, stream, ident, parent): """abort a specific msg by id""" - self.log.warn("abort_request is deprecated in kernel_base. It os only part of IPython parallel") + self.log.warning("abort_request is deprecated in kernel_base. It os only part of IPython parallel") msg_ids = parent['content'].get('msg_ids', None) if isinstance(msg_ids, string_types): msg_ids = [msg_ids] @@ -611,7 +611,7 @@ def clear_request(self, stream, idents, parent): """Clear our namespace.""" - self.log.warn("clear_request is deprecated in kernel_base. It os only part of IPython parallel") + self.log.warning("clear_request is deprecated in kernel_base. It os only part of IPython parallel") content = self.do_clear() self.session.send(stream, 'clear_reply', ident=idents, parent=parent, content = content) @@ -728,7 +728,7 @@ try: ident, reply = self.session.recv(self.stdin_socket, 0) except Exception: - self.log.warn("Invalid Message:", exc_info=True) + self.log.warning("Invalid Message:", exc_info=True) except KeyboardInterrupt: # re-raise KeyboardInterrupt, to truncate traceback raise KeyboardInterrupt diff -Nru ipykernel-4.8.2/ipykernel/pylab/backend_inline.py ipykernel-4.9.0/ipykernel/pylab/backend_inline.py --- ipykernel-4.8.2/ipykernel/pylab/backend_inline.py 2018-02-19 16:18:33.000000000 +0000 +++ ipykernel-4.9.0/ipykernel/pylab/backend_inline.py 2018-08-29 18:42:32.000000000 +0000 @@ -7,6 +7,7 @@ import matplotlib from matplotlib.backends.backend_agg import new_figure_manager, FigureCanvasAgg # analysis: ignore +from matplotlib import colors from matplotlib._pylab_helpers import Gcf from IPython.core.getipython import get_ipython @@ -33,7 +34,10 @@ close = InlineBackend.instance().close_figures try: for figure_manager in Gcf.get_all_fig_managers(): - display(figure_manager.canvas.figure) + display( + figure_manager.canvas.figure, + metadata=_fetch_figure_metadata(figure_manager.canvas.figure) + ) finally: show._to_draw = [] # only call close('all') if any to close @@ -72,7 +76,7 @@ if not hasattr(fig, 'show'): # Queue up `fig` for display - fig.show = lambda *a: display(fig) + fig.show = lambda *a: display(fig, metadata=_fetch_figure_metadata(fig)) # If matplotlib was manually set to non-interactive mode, this function # should be a no-op (otherwise we'll generate duplicate plots, since a user @@ -124,7 +128,7 @@ active = set([fm.canvas.figure for fm in Gcf.get_all_fig_managers()]) for fig in [ fig for fig in show._to_draw if fig in active ]: try: - display(fig) + display(fig, metadata=_fetch_figure_metadata(fig)) except Exception as e: # safely show traceback if in IPython, else raise ip = get_ipython() @@ -163,3 +167,30 @@ ip.events.register('post_run_cell', configure_once) _enable_matplotlib_integration() + +def _fetch_figure_metadata(fig): + """Get some metadata to help with displaying a figure.""" + # determine if a background is needed for legibility + if _is_transparent(fig.get_facecolor()): + # the background is transparent + ticksLight = _is_light([label.get_color() + for axes in fig.axes + for axis in (axes.xaxis, axes.yaxis) + for label in axis.get_ticklabels()]) + if ticksLight.size and (ticksLight == ticksLight[0]).all(): + # there are one or more tick labels, all with the same lightness + return {'needs_background': 'dark' if ticksLight[0] else 'light'} + + return None + +def _is_light(color): + """Determines if a color (or each of a sequence of colors) is light (as + opposed to dark). Based on ITU BT.601 luminance formula (see + https://stackoverflow.com/a/596241).""" + rgbaArr = colors.to_rgba_array(color) + return rgbaArr[:,:3].dot((.299, .587, .114)) > .5 + +def _is_transparent(color): + """Determine transparency from alpha.""" + rgba = colors.to_rgba(color) + return rgba[3] < .5 diff -Nru ipykernel-4.8.2/ipykernel/_version.py ipykernel-4.9.0/ipykernel/_version.py --- ipykernel-4.8.2/ipykernel/_version.py 2018-02-19 16:18:33.000000000 +0000 +++ ipykernel-4.9.0/ipykernel/_version.py 2018-08-29 18:42:32.000000000 +0000 @@ -1,4 +1,4 @@ -version_info = (4, 8, 2) +version_info = (4, 9, 0) __version__ = '.'.join(map(str, version_info)) kernel_protocol_version_info = (5, 1) diff -Nru ipykernel-4.8.2/setup.cfg ipykernel-4.9.0/setup.cfg --- ipykernel-4.8.2/setup.cfg 2018-02-19 16:18:33.000000000 +0000 +++ ipykernel-4.9.0/setup.cfg 2018-08-29 18:42:32.000000000 +0000 @@ -1,6 +1,9 @@ [bdist_wheel] universal=0 +[metadata] +license_file = COPYING.md + [nosetests] warningfilters= default |.* |DeprecationWarning |ipykernel.* error |.*invalid.* |DeprecationWarning |matplotlib.* diff -Nru ipykernel-4.8.2/setup.py ipykernel-4.9.0/setup.py --- ipykernel-4.8.2/setup.py 2018-02-19 16:18:33.000000000 +0000 +++ ipykernel-4.9.0/setup.py 2018-08-29 18:42:32.000000000 +0000 @@ -16,8 +16,8 @@ import sys v = sys.version_info -if v[:2] < (2,7) or (v[0] >= 3 and v[:2] < (3,3)): - error = "ERROR: %s requires Python version 2.7 or 3.3 or above." % name +if v[:2] < (2,7) or (v[0] >= 3 and v[:2] < (3,4)): + error = "ERROR: %s requires Python version 2.7 or 3.4 or above." % name print(error, file=sys.stderr) sys.exit(1) @@ -101,12 +101,13 @@ glob(pjoin('data_kernelspec', '*'))), ] + +setuptools_args['python_requires'] = '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*' + extras_require = setuptools_args['extras_require'] = { 'test:python_version=="2.7"': ['mock'], - # pytest 3.3 doesn't work on Python 3.3 - 'test:python_version=="3.3"': ['pytest==3.2.*'], - 'test:python_version!="3.3"': ['pytest>=3.2'], 'test': [ + 'pytest', 'pytest-cov', 'nose', # nose because there are still a few nose.tools imports hanging around ], diff -Nru ipykernel-4.8.2/.travis.yml ipykernel-4.9.0/.travis.yml --- ipykernel-4.8.2/.travis.yml 2018-02-19 16:18:33.000000000 +0000 +++ ipykernel-4.9.0/.travis.yml 2018-08-29 18:42:32.000000000 +0000 @@ -1,10 +1,10 @@ language: python python: - "nightly" + - "3.7-dev" - 3.6 - 3.5 - 3.4 - - 3.3 - 2.7 sudo: false install: