python3-ipython_ipykernel: patches for ipython 9.0

Closes: #54616 [via git-merge-pr]
This commit is contained in:
Gonzalo Tornaría 2025-03-06 16:09:26 -03:00 committed by Andrew J. Hesford
parent bd40fb0997
commit eaa3e5a564
4 changed files with 94 additions and 1 deletions

View file

@ -0,0 +1,37 @@
From 4854752dc86e0e823c2a114e7ca68cecb76af442 Mon Sep 17 00:00:00 2001
From: M Bussonnier <bussonniermatthias@gmail.com>
Date: Mon, 24 Feb 2025 09:46:46 +0100
Subject: [PATCH] Fix expected text depending on IPython version. (#1354)
---
tests/test_start_kernel.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tests/test_start_kernel.py b/tests/test_start_kernel.py
index f2a632be0..71f4bdc0a 100644
--- a/tests/test_start_kernel.py
+++ b/tests/test_start_kernel.py
@@ -14,6 +14,14 @@
@flaky(max_runs=3)
def test_ipython_start_kernel_userns():
+ import IPython
+
+ if IPython.version_info > (9, 0): # noqa:SIM108
+ EXPECTED = "IPythonMainModule"
+ else:
+ # not this since https://github.com/ipython/ipython/pull/14754
+ EXPECTED = "DummyMod"
+
cmd = dedent(
"""
from ipykernel.kernelapp import launch_new_instance
@@ -40,7 +48,7 @@ def test_ipython_start_kernel_userns():
content = msg["content"]
assert content["found"]
text = content["data"]["text/plain"]
- assert "DummyMod" in text
+ assert EXPECTED in text
@flaky(max_runs=3)

View file

@ -0,0 +1,27 @@
From https://github.com/ipython/ipykernel/pull/1390
From 05ee4fd4630020a3a13895bfddd16ddcfc423387 Mon Sep 17 00:00:00 2001
From: Ian Thomas <ianthomas23@gmail.com>
Date: Fri, 11 Apr 2025 10:25:39 +0100
Subject: [PATCH] Fix embed kernel (taken from #1322)
---
ipykernel/embed.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ipykernel/embed.py b/ipykernel/embed.py
index 3e4abd390..d2cbe60b4 100644
--- a/ipykernel/embed.py
+++ b/ipykernel/embed.py
@@ -49,9 +49,10 @@ def embed_kernel(module=None, local_ns=None, **kwargs):
if module is None:
module = caller_module
if local_ns is None:
- local_ns = caller_locals
+ local_ns = dict(**caller_locals)
app.kernel.user_module = module
+ assert isinstance(local_ns, dict)
app.kernel.user_ns = local_ns
app.shell.set_completer_frame() # type:ignore[union-attr]
app.start()

View file

@ -0,0 +1,29 @@
From https://github.com/ipython/ipykernel/pull/1390
From 991068ddc26cc0078ec6466897bb4f84869e7068 Mon Sep 17 00:00:00 2001
From: Ian Thomas <ianthomas23@gmail.com>
Date: Thu, 10 Apr 2025 13:36:43 +0100
Subject: [PATCH] Remove welcome_message arg from enable_pylab
---
ipykernel/inprocess/ipkernel.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ipykernel/inprocess/ipkernel.py b/ipykernel/inprocess/ipkernel.py
index 873b96d20..320b739b6 100644
--- a/ipykernel/inprocess/ipkernel.py
+++ b/ipykernel/inprocess/ipkernel.py
@@ -193,11 +193,11 @@ def enable_matplotlib(self, gui=None):
gui = self.kernel.gui
return super().enable_matplotlib(gui)
- def enable_pylab(self, gui=None, import_all=True, welcome_message=False):
+ def enable_pylab(self, gui=None, import_all=True):
"""Activate pylab support at runtime."""
if not gui:
gui = self.kernel.gui
- return super().enable_pylab(gui, import_all, welcome_message)
+ return super().enable_pylab(gui, import_all)
InteractiveShellABC.register(InProcessInteractiveShell)

View file

@ -1,7 +1,7 @@
# Template file for 'python3-ipython_ipykernel'
pkgname=python3-ipython_ipykernel
version=6.29.5
revision=3
revision=4
build_style=python3-pep517
# run all tests available
make_check_target="tests"