diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f3457aa2..e3416c18e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,6 @@ name: ipykernel tests -on: - push: - branches: [master] - pull_request: - branches: [master] +on: [push, pull_request] jobs: build: @@ -43,6 +39,7 @@ jobs: - name: Install the Python dependencies run: | pip install --pre --upgrade --upgrade-strategy=eager .[test] codecov + pip install jupyter_client==6.1.* - name: Install matplotlib if: ${{ matrix.os != 'macos' && matrix.python-version != 'pypy3' }} run: | diff --git a/docs/changelog.rst b/docs/changelog.rst index ad06796ca..bebf84418 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,9 +4,37 @@ Changes in IPython kernel 5.5 --- +5.5.6 +----- +- Add `ipython_genutils` dependency (:ghpull:`778`) + +5.5.5 +----- +- Keep preferring SelectorEventLoop on Windows. (:ghpull:`669`) + +5.5.4 +----- +- Import ``configure_inline_support`` from ``matplotlib_inline`` if available (:ghpull:`654`) + +5.5.3 +----- +- Revert Backport of #605: Fix Handling of ``shell.should_run_async`` (:ghpull:`622`) + +5.5.2 +----- +**Note:** This release was deleted from PyPI since it had breaking changes. + +- Changed default timeout to 0.0 seconds for stop_on_error_timeout. (:ghpull:`618`) + +5.5.1 +----- +**Note:** This release was deleted from PyPI since it had breaking changes. + +- Fix Handling of ``shell.should_run_async``. (:ghpull:`605`) + 5.5.0 ----- -- Kernelspec: ensure path is writable before writing ``kernel.json``. (:ghpull:`593`) +- Kernelspec: ensure path is writable before writing ``kernel.json``. (:ghpull:`593`) - Add ``configure_inline_support`` and call it in the shell. (:ghpull:`590`) 5.4 @@ -31,7 +59,7 @@ Changes in IPython kernel - Add github actions, bail on asyncio patch for tornado 6.1. (:ghpull:`564`) - Start testing on Python 3.9. (:ghpull:`551`) -- Fix stack levels for ipykernel's deprecation warnings and stop using some deprecated APIs. (:ghpull:`547`) +- Fix stack levels for ipykernel's deprecation warnings and stop using some deprecated APIs. (:ghpull:`547`) - Add env parameter to kernel installation (:ghpull:`541`) - Fix stop_on_error_timeout blocking other messages in queue. (:ghpull:`539`) - Remove most of the python 2 compat code. (:ghpull:`537`) diff --git a/ipykernel/_version.py b/ipykernel/_version.py index 426163978..cf3510d7b 100644 --- a/ipykernel/_version.py +++ b/ipykernel/_version.py @@ -1,4 +1,4 @@ -version_info = (5, 5, 0) +version_info = (5, 5, 6) __version__ = '.'.join(map(str, version_info[:3])) # pep440 is annoying, beta/alpha/rc should _not_ have dots or pip/setuptools diff --git a/ipykernel/ipkernel.py b/ipykernel/ipkernel.py index 661627352..9a85a02f2 100644 --- a/ipykernel/ipkernel.py +++ b/ipykernel/ipkernel.py @@ -372,14 +372,14 @@ def do_complete(self, code, cursor_pos): def _experimental_do_complete(self, code, cursor_pos): """ - Experimental completions from IPython, using Jedi. + Experimental completions from IPython, using Jedi. """ if cursor_pos is None: cursor_pos = len(code) with _provisionalcompleter(): raw_completions = self.shell.Completer.completions(code, cursor_pos) completions = list(_rectify_completions(code, raw_completions)) - + comps = [] for comp in completions: comps.append(dict( diff --git a/ipykernel/kernelapp.py b/ipykernel/kernelapp.py index ee691508e..fb3caa001 100644 --- a/ipykernel/kernelapp.py +++ b/ipykernel/kernelapp.py @@ -516,14 +516,21 @@ def _init_asyncio_patch(self): Pick the older SelectorEventLoopPolicy on Windows if the known-incompatible default policy is in use. + Support for Proactor via a background thread is available in tornado 6.1, + but it is still preferable to run the Selector in the main thread + instead of the background. + do this as early as possible to make it a low priority and overrideable ref: https://github.com/tornadoweb/tornado/issues/2608 - FIXME: if/when tornado supports the defaults in asyncio, - remove and bump tornado requirement for py38 + FIXME: if/when tornado supports the defaults in asyncio without threads, + remove and bump tornado requirement for py38. + Most likely, this will mean a new Python version + where asyncio.ProactorEventLoop supports add_reader and friends. + """ - if sys.platform.startswith("win") and sys.version_info >= (3, 8) and tornado.version_info < (6, 1): + if sys.platform.startswith("win") and sys.version_info >= (3, 8): import asyncio try: from asyncio import ( diff --git a/ipykernel/kernelbase.py b/ipykernel/kernelbase.py index aba3223a9..8b228fec9 100644 --- a/ipykernel/kernelbase.py +++ b/ipykernel/kernelbase.py @@ -110,7 +110,7 @@ def _default_ident(self): _poll_interval = Float(0.01).tag(config=True) stop_on_error_timeout = Float( - 0.1, + 0.0, config=True, help="""time (in seconds) to wait for messages to arrive when aborting queued requests after an error. @@ -261,6 +261,9 @@ def dispatch_shell(self, stream, msg): yield gen.maybe_future(handler(stream, idents, msg)) except Exception: self.log.error("Exception in message handler:", exc_info=True) + except KeyboardInterrupt: + # Ctrl-c shouldn't crash the kernel here. + self.log.error("KeyboardInterrupt caught in kernel.") finally: try: self.post_handler_hook() diff --git a/ipykernel/zmqshell.py b/ipykernel/zmqshell.py index 8c9cfecce..1135ea749 100644 --- a/ipykernel/zmqshell.py +++ b/ipykernel/zmqshell.py @@ -600,7 +600,10 @@ def init_magics(self): def enable_matplotlib(self, gui=None): gui, backend = super(ZMQInteractiveShell, self).enable_matplotlib(gui) - from ipykernel.pylab.backend_inline import configure_inline_support + try: + from matplotlib_inline.backend_inline import configure_inline_support + except ImportError: + from ipykernel.pylab.backend_inline import configure_inline_support configure_inline_support(self, backend) diff --git a/pyproject.toml b/pyproject.toml index e220b587e..8f3860225 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,6 @@ [build-system] requires=[ + "ipython_genutils", "setuptools", "wheel", "ipython>=5", diff --git a/setup.py b/setup.py index d9f51c2c7..d254b7639 100644 --- a/setup.py +++ b/setup.py @@ -85,6 +85,7 @@ def run(self): keywords=['Interactive', 'Interpreter', 'Shell', 'Web'], python_requires='>=3.5', install_requires=[ + 'ipython_genutils', 'ipython>=5.0.0', 'traitlets>=4.1.0', 'jupyter_client',