From 31b4e3d45fd60c23cbe82311b277f8b2cd359280a72d239f438af4667e2bb7a1 Mon Sep 17 00:00:00 2001 From: Benjamin Greiner Date: Tue, 3 Jan 2023 14:09:30 +0000 Subject: [PATCH 1/3] Accepting request 1046535 from home:mcalabkova:branches:devel:languages:python - Add patch pygments214.patch to fix tests with new Pygments OBS-URL: https://build.opensuse.org/request/show/1046535 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:jupyter/python-ipython?expand=0&rev=101 --- pygments214.patch | 171 +++++++++++++++++++++++++++++++++++++++++ python-ipython.changes | 5 ++ python-ipython.spec | 4 +- 3 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 pygments214.patch diff --git a/pygments214.patch b/pygments214.patch new file mode 100644 index 0000000..8fc433e --- /dev/null +++ b/pygments214.patch @@ -0,0 +1,171 @@ +From ed7f35f8b721d4b4dcafea173ce724bee25704c7 Mon Sep 17 00:00:00 2001 +From: Matthias Bussonnier +Date: Tue, 3 Jan 2023 11:57:18 +0100 +Subject: [PATCH] Fix tests for pygments > 2.14 + +Pygments 2.14+ have the bash lexer return some tokens as +Text.Whitespace instead of Text, this update the test to support this. +--- + IPython/lib/tests/test_lexers.py | 52 ++++++++++++++++++-------------- + 1 file changed, 30 insertions(+), 22 deletions(-) + +diff --git a/IPython/lib/tests/test_lexers.py b/IPython/lib/tests/test_lexers.py +index efa00d601ea..000b8fe6fd9 100644 +--- a/IPython/lib/tests/test_lexers.py ++++ b/IPython/lib/tests/test_lexers.py +@@ -4,11 +4,14 @@ + # Distributed under the terms of the Modified BSD License. + + from unittest import TestCase ++from pygments import __version__ as pygments_version + from pygments.token import Token + from pygments.lexers import BashLexer + + from .. import lexers + ++pyg214 = tuple(int(x) for x in pygments_version.split(".")[:2]) >= (2, 14) ++ + + class TestLexers(TestCase): + """Collection of lexers tests""" +@@ -18,25 +21,26 @@ def setUp(self): + + def testIPythonLexer(self): + fragment = '!echo $HOME\n' +- tokens = [ ++ bash_tokens = [ + (Token.Operator, '!'), + ] +- tokens.extend(self.bash_lexer.get_tokens(fragment[1:])) +- self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) ++ bash_tokens.extend(self.bash_lexer.get_tokens(fragment[1:])) ++ ipylex_token = list(self.lexer.get_tokens(fragment)) ++ assert bash_tokens[:-1] == ipylex_token[:-1] + +- fragment_2 = '!' + fragment ++ fragment_2 = "!" + fragment + tokens_2 = [ + (Token.Operator, '!!'), +- ] + tokens[1:] +- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) ++ ] + bash_tokens[1:] ++ assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1] + + fragment_2 = '\t %%!\n' + fragment[1:] + tokens_2 = [ + (Token.Text, '\t '), + (Token.Operator, '%%!'), + (Token.Text, '\n'), +- ] + tokens[1:] +- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) ++ ] + bash_tokens[1:] ++ assert tokens_2 == list(self.lexer.get_tokens(fragment_2)) + + fragment_2 = 'x = ' + fragment + tokens_2 = [ +@@ -44,8 +48,8 @@ def testIPythonLexer(self): + (Token.Text, ' '), + (Token.Operator, '='), + (Token.Text, ' '), +- ] + tokens +- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) ++ ] + bash_tokens ++ assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1] + + fragment_2 = 'x, = ' + fragment + tokens_2 = [ +@@ -54,8 +58,8 @@ def testIPythonLexer(self): + (Token.Text, ' '), + (Token.Operator, '='), + (Token.Text, ' '), +- ] + tokens +- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) ++ ] + bash_tokens ++ assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1] + + fragment_2 = 'x, = %sx ' + fragment[1:] + tokens_2 = [ +@@ -67,8 +71,10 @@ def testIPythonLexer(self): + (Token.Operator, '%'), + (Token.Keyword, 'sx'), + (Token.Text, ' '), +- ] + tokens[1:] +- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) ++ ] + bash_tokens[1:] ++ if tokens_2[7] == (Token.Text, " ") and pyg214: # pygments 2.14+ ++ tokens_2[7] = (Token.Text.Whitespace, " ") ++ assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1] + + fragment_2 = 'f = %R function () {}\n' + tokens_2 = [ +@@ -80,7 +86,7 @@ def testIPythonLexer(self): + (Token.Keyword, 'R'), + (Token.Text, ' function () {}\n'), + ] +- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) ++ assert tokens_2 == list(self.lexer.get_tokens(fragment_2)) + + fragment_2 = '\t%%xyz\n$foo\n' + tokens_2 = [ +@@ -89,7 +95,7 @@ def testIPythonLexer(self): + (Token.Keyword, 'xyz'), + (Token.Text, '\n$foo\n'), + ] +- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) ++ assert tokens_2 == list(self.lexer.get_tokens(fragment_2)) + + fragment_2 = '%system?\n' + tokens_2 = [ +@@ -98,7 +104,7 @@ def testIPythonLexer(self): + (Token.Operator, '?'), + (Token.Text, '\n'), + ] +- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) ++ assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1] + + fragment_2 = 'x != y\n' + tokens_2 = [ +@@ -109,7 +115,7 @@ def testIPythonLexer(self): + (Token.Name, 'y'), + (Token.Text, '\n'), + ] +- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) ++ assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1] + + fragment_2 = ' ?math.sin\n' + tokens_2 = [ +@@ -118,7 +124,7 @@ def testIPythonLexer(self): + (Token.Text, 'math.sin'), + (Token.Text, '\n'), + ] +- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) ++ assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1] + + fragment = ' *int*?\n' + tokens = [ +@@ -126,7 +132,7 @@ def testIPythonLexer(self): + (Token.Operator, '?'), + (Token.Text, '\n'), + ] +- self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) ++ assert tokens == list(self.lexer.get_tokens(fragment)) + + fragment = '%%writefile -a foo.py\nif a == b:\n pass' + tokens = [ +@@ -145,7 +151,9 @@ def testIPythonLexer(self): + (Token.Keyword, 'pass'), + (Token.Text, '\n'), + ] +- self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) ++ if tokens[10] == (Token.Text, "\n") and pyg214: # pygments 2.14+ ++ tokens[10] = (Token.Text.Whitespace, "\n") ++ assert tokens[:-1] == list(self.lexer.get_tokens(fragment))[:-1] + + fragment = '%%timeit\nmath.sin(0)' + tokens = [ +@@ -173,4 +181,4 @@ def testIPythonLexer(self): + (Token.Punctuation, '>'), + (Token.Text, '\n'), + ] +- self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) ++ assert tokens == list(self.lexer.get_tokens(fragment)) diff --git a/python-ipython.changes b/python-ipython.changes index cbae7dc..88f5359 100644 --- a/python-ipython.changes +++ b/python-ipython.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Jan 3 14:03:46 UTC 2023 - Markéta Machová + +- Add patch pygments214.patch to fix tests with new Pygments + ------------------------------------------------------------------- Sun Dec 25 19:08:47 UTC 2022 - Ben Greiner diff --git a/python-ipython.spec b/python-ipython.spec index 824f53a..511c9ea 100644 --- a/python-ipython.spec +++ b/python-ipython.spec @@ -1,7 +1,7 @@ # # spec file # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -40,6 +40,8 @@ Group: Development/Languages/Python URL: https://github.com/ipython/ipython Source: https://files.pythonhosted.org/packages/source/i/ipython/ipython-%{version}.tar.gz Source1: https://raw.githubusercontent.com/jupyter/qtconsole/4.0.0/qtconsole/resources/icon/JupyterConsole.svg +# PATCH-FIX-UPSTREAM https://github.com/ipython/ipython/pull/13882 Fix tests for pygments >= 2.14 +Patch: pygments214.patch BuildRequires: %{python_module base >= 3.8} BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools >= 51.0.0} From ace80d5a62377f0fa305d25e7c2f819c51c2a5ad896f3b9dce2dfb66ead49956 Mon Sep 17 00:00:00 2001 From: Benjamin Greiner Date: Tue, 3 Jan 2023 14:16:57 +0000 Subject: [PATCH 2/3] Accepting request 1046538 from home:mcalabkova:branches:devel:languages:python - Update to 8.8.0 * replace the greedy completer and improve completion, in particular for dictionary keys * adds py.typed to setup.cfg to make sure it is bundled in wheels * implements tab completions for IPython options in the shell when using argcomplete * makes the inspector class of InteractiveShell configurable * makes tests compatible with Pygments >= 2.14 * more changes, see upstream 8.8.0 milestone OBS-URL: https://build.opensuse.org/request/show/1046538 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:jupyter/python-ipython?expand=0&rev=102 --- ipython-8.7.0.tar.gz | 3 - ipython-8.8.0.tar.gz | 3 + pygments214.patch | 171 ----------------------------------------- python-ipython.changes | 10 ++- python-ipython.spec | 4 +- 5 files changed, 13 insertions(+), 178 deletions(-) delete mode 100644 ipython-8.7.0.tar.gz create mode 100644 ipython-8.8.0.tar.gz delete mode 100644 pygments214.patch diff --git a/ipython-8.7.0.tar.gz b/ipython-8.7.0.tar.gz deleted file mode 100644 index 3d4624a..0000000 --- a/ipython-8.7.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:882899fe78d5417a0aa07f995db298fa28b58faeba2112d2e3a4c95fe14bb738 -size 5329857 diff --git a/ipython-8.8.0.tar.gz b/ipython-8.8.0.tar.gz new file mode 100644 index 0000000..880dbc7 --- /dev/null +++ b/ipython-8.8.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3bf2c08505ad2c3f4ed5c46ae0331a8547d36bf4b21a451e8ae80c0791db95b +size 5341086 diff --git a/pygments214.patch b/pygments214.patch deleted file mode 100644 index 8fc433e..0000000 --- a/pygments214.patch +++ /dev/null @@ -1,171 +0,0 @@ -From ed7f35f8b721d4b4dcafea173ce724bee25704c7 Mon Sep 17 00:00:00 2001 -From: Matthias Bussonnier -Date: Tue, 3 Jan 2023 11:57:18 +0100 -Subject: [PATCH] Fix tests for pygments > 2.14 - -Pygments 2.14+ have the bash lexer return some tokens as -Text.Whitespace instead of Text, this update the test to support this. ---- - IPython/lib/tests/test_lexers.py | 52 ++++++++++++++++++-------------- - 1 file changed, 30 insertions(+), 22 deletions(-) - -diff --git a/IPython/lib/tests/test_lexers.py b/IPython/lib/tests/test_lexers.py -index efa00d601ea..000b8fe6fd9 100644 ---- a/IPython/lib/tests/test_lexers.py -+++ b/IPython/lib/tests/test_lexers.py -@@ -4,11 +4,14 @@ - # Distributed under the terms of the Modified BSD License. - - from unittest import TestCase -+from pygments import __version__ as pygments_version - from pygments.token import Token - from pygments.lexers import BashLexer - - from .. import lexers - -+pyg214 = tuple(int(x) for x in pygments_version.split(".")[:2]) >= (2, 14) -+ - - class TestLexers(TestCase): - """Collection of lexers tests""" -@@ -18,25 +21,26 @@ def setUp(self): - - def testIPythonLexer(self): - fragment = '!echo $HOME\n' -- tokens = [ -+ bash_tokens = [ - (Token.Operator, '!'), - ] -- tokens.extend(self.bash_lexer.get_tokens(fragment[1:])) -- self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) -+ bash_tokens.extend(self.bash_lexer.get_tokens(fragment[1:])) -+ ipylex_token = list(self.lexer.get_tokens(fragment)) -+ assert bash_tokens[:-1] == ipylex_token[:-1] - -- fragment_2 = '!' + fragment -+ fragment_2 = "!" + fragment - tokens_2 = [ - (Token.Operator, '!!'), -- ] + tokens[1:] -- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) -+ ] + bash_tokens[1:] -+ assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1] - - fragment_2 = '\t %%!\n' + fragment[1:] - tokens_2 = [ - (Token.Text, '\t '), - (Token.Operator, '%%!'), - (Token.Text, '\n'), -- ] + tokens[1:] -- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) -+ ] + bash_tokens[1:] -+ assert tokens_2 == list(self.lexer.get_tokens(fragment_2)) - - fragment_2 = 'x = ' + fragment - tokens_2 = [ -@@ -44,8 +48,8 @@ def testIPythonLexer(self): - (Token.Text, ' '), - (Token.Operator, '='), - (Token.Text, ' '), -- ] + tokens -- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) -+ ] + bash_tokens -+ assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1] - - fragment_2 = 'x, = ' + fragment - tokens_2 = [ -@@ -54,8 +58,8 @@ def testIPythonLexer(self): - (Token.Text, ' '), - (Token.Operator, '='), - (Token.Text, ' '), -- ] + tokens -- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) -+ ] + bash_tokens -+ assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1] - - fragment_2 = 'x, = %sx ' + fragment[1:] - tokens_2 = [ -@@ -67,8 +71,10 @@ def testIPythonLexer(self): - (Token.Operator, '%'), - (Token.Keyword, 'sx'), - (Token.Text, ' '), -- ] + tokens[1:] -- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) -+ ] + bash_tokens[1:] -+ if tokens_2[7] == (Token.Text, " ") and pyg214: # pygments 2.14+ -+ tokens_2[7] = (Token.Text.Whitespace, " ") -+ assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1] - - fragment_2 = 'f = %R function () {}\n' - tokens_2 = [ -@@ -80,7 +86,7 @@ def testIPythonLexer(self): - (Token.Keyword, 'R'), - (Token.Text, ' function () {}\n'), - ] -- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) -+ assert tokens_2 == list(self.lexer.get_tokens(fragment_2)) - - fragment_2 = '\t%%xyz\n$foo\n' - tokens_2 = [ -@@ -89,7 +95,7 @@ def testIPythonLexer(self): - (Token.Keyword, 'xyz'), - (Token.Text, '\n$foo\n'), - ] -- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) -+ assert tokens_2 == list(self.lexer.get_tokens(fragment_2)) - - fragment_2 = '%system?\n' - tokens_2 = [ -@@ -98,7 +104,7 @@ def testIPythonLexer(self): - (Token.Operator, '?'), - (Token.Text, '\n'), - ] -- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) -+ assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1] - - fragment_2 = 'x != y\n' - tokens_2 = [ -@@ -109,7 +115,7 @@ def testIPythonLexer(self): - (Token.Name, 'y'), - (Token.Text, '\n'), - ] -- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) -+ assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1] - - fragment_2 = ' ?math.sin\n' - tokens_2 = [ -@@ -118,7 +124,7 @@ def testIPythonLexer(self): - (Token.Text, 'math.sin'), - (Token.Text, '\n'), - ] -- self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) -+ assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1] - - fragment = ' *int*?\n' - tokens = [ -@@ -126,7 +132,7 @@ def testIPythonLexer(self): - (Token.Operator, '?'), - (Token.Text, '\n'), - ] -- self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) -+ assert tokens == list(self.lexer.get_tokens(fragment)) - - fragment = '%%writefile -a foo.py\nif a == b:\n pass' - tokens = [ -@@ -145,7 +151,9 @@ def testIPythonLexer(self): - (Token.Keyword, 'pass'), - (Token.Text, '\n'), - ] -- self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) -+ if tokens[10] == (Token.Text, "\n") and pyg214: # pygments 2.14+ -+ tokens[10] = (Token.Text.Whitespace, "\n") -+ assert tokens[:-1] == list(self.lexer.get_tokens(fragment))[:-1] - - fragment = '%%timeit\nmath.sin(0)' - tokens = [ -@@ -173,4 +181,4 @@ def testIPythonLexer(self): - (Token.Punctuation, '>'), - (Token.Text, '\n'), - ] -- self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) -+ assert tokens == list(self.lexer.get_tokens(fragment)) diff --git a/python-ipython.changes b/python-ipython.changes index 88f5359..5484335 100644 --- a/python-ipython.changes +++ b/python-ipython.changes @@ -1,7 +1,15 @@ ------------------------------------------------------------------- Tue Jan 3 14:03:46 UTC 2023 - Markéta Machová -- Add patch pygments214.patch to fix tests with new Pygments +- Update to 8.8.0 + * replace the greedy completer and improve completion, in particular + for dictionary keys + * adds py.typed to setup.cfg to make sure it is bundled in wheels + * implements tab completions for IPython options in the shell when + using argcomplete + * makes the inspector class of InteractiveShell configurable + * makes tests compatible with Pygments >= 2.14 + * more changes, see upstream 8.8.0 milestone ------------------------------------------------------------------- Sun Dec 25 19:08:47 UTC 2022 - Ben Greiner diff --git a/python-ipython.spec b/python-ipython.spec index 511c9ea..0f30fa4 100644 --- a/python-ipython.spec +++ b/python-ipython.spec @@ -32,7 +32,7 @@ # extra tests are skipped automatically, don't require these packages for Ring1 %bcond_with localtest Name: python-ipython%{psuffix} -Version: 8.7.0 +Version: 8.8.0 Release: 0 Summary: Rich architecture for interactive computing with Python License: BSD-3-Clause @@ -40,8 +40,6 @@ Group: Development/Languages/Python URL: https://github.com/ipython/ipython Source: https://files.pythonhosted.org/packages/source/i/ipython/ipython-%{version}.tar.gz Source1: https://raw.githubusercontent.com/jupyter/qtconsole/4.0.0/qtconsole/resources/icon/JupyterConsole.svg -# PATCH-FIX-UPSTREAM https://github.com/ipython/ipython/pull/13882 Fix tests for pygments >= 2.14 -Patch: pygments214.patch BuildRequires: %{python_module base >= 3.8} BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools >= 51.0.0} From 78369b141fd66a3f78fc65085bd33e648c5cd2e42c4ada8145c8f097777185ce Mon Sep 17 00:00:00 2001 From: Benjamin Greiner Date: Tue, 3 Jan 2023 16:17:56 +0000 Subject: [PATCH 3/3] Accepting request 1046564 from home:bnavigator:branches:devel:languages:python:jupyter - Remove the ipythonMAJ.MIN entrypoint * gh#ipython/ipyton#13815 * gh#ipython/ipyton#13880 OBS-URL: https://build.opensuse.org/request/show/1046564 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:jupyter/python-ipython?expand=0&rev=103 --- python-ipython.changes | 7 +++++++ python-ipython.spec | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/python-ipython.changes b/python-ipython.changes index 5484335..3be82d5 100644 --- a/python-ipython.changes +++ b/python-ipython.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Jan 3 14:26:56 UTC 2023 - Ben Greiner + +- Remove the ipythonMAJ.MIN entrypoint + * gh#ipython/ipyton#13815 + * gh#ipython/ipyton#13880 + ------------------------------------------------------------------- Tue Jan 3 14:03:46 UTC 2023 - Markéta Machová diff --git a/python-ipython.spec b/python-ipython.spec index 0f30fa4..ba0e9cc 100644 --- a/python-ipython.spec +++ b/python-ipython.spec @@ -161,8 +161,6 @@ popd %python_clone -a %{buildroot}%{_bindir}/ipython %python_clone -a %{buildroot}%{_bindir}/ipython3 -# gh#ipython/ipython#13815 -%python_expand cp %{buildroot}%{_bindir}/ipython{-%{$python_bin_suffix },%{$python_bin_suffix}} # must clone after copy cp %{buildroot}%{_mandir}/man1/ipython{,3}.1 @@ -205,8 +203,6 @@ $python -O -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/IP %if %{with test} %check -# check our fix for https://github.com/ipython/ipython/issues/13815 -%python_expand ipython%{$python_bin_suffix} --show-config | grep "Python %{$python_version}" export PYTHONPATH=$(pwd) %pytest %endif @@ -233,7 +229,6 @@ export PYTHONPATH=$(pwd) %doc README.rst docs/source/about/license_and_copyright.rst %python_alternative %{_bindir}/ipython %python_alternative %{_bindir}/ipython3 -%{_bindir}/ipython%{python_bin_suffix} %python_alternative %{_mandir}/man1/ipython.1.gz %python_alternative %{_mandir}/man1/ipython3.1.gz %{python_sitelib}/IPython/