From c44d9172ea16802a1d01a36cd0b283ba712a7d80 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Thu, 26 Mar 2026 14:04:23 +0100 Subject: [PATCH 1/7] Remove unused flake8 config --- .flake8 | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .flake8 diff --git a/.flake8 b/.flake8 deleted file mode 100644 index c321e71c9..000000000 --- a/.flake8 +++ /dev/null @@ -1,5 +0,0 @@ -[flake8] -ignore = E203, E266, E501, W503 -max-line-length = 80 -max-complexity = 18 -select = B,C,E,F,W,T4,B9 From 3dd1034c55e15cc8238a262c2fb60b16bf27a0af Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Thu, 26 Mar 2026 14:14:57 +0100 Subject: [PATCH 2/7] Add more type annotations --- bpython/repl.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/bpython/repl.py b/bpython/repl.py index 2ced5b7a8..93ce5cbc2 100644 --- a/bpython/repl.py +++ b/bpython/repl.py @@ -337,7 +337,7 @@ def clear(self) -> None: class Interaction(metaclass=abc.ABCMeta): - def __init__(self, config: Config): + def __init__(self, config: Config) -> None: self.config = config @abc.abstractmethod @@ -356,7 +356,7 @@ def file_prompt(self, s: str) -> str | None: class NoInteraction(Interaction): - def __init__(self, config: Config): + def __init__(self, config: Config) -> None: super().__init__(config) def confirm(self, s: str) -> bool: @@ -467,7 +467,7 @@ def cursor_offset(self, value: int) -> None: # not actually defined, subclasses must define cpos: int - def __init__(self, interp: Interpreter, config: Config): + def __init__(self, interp: Interpreter, config: Config) -> None: """Initialise the repl. interp is a Python code.InteractiveInterpreter instance @@ -851,7 +851,7 @@ def next_indentation(self) -> int: ) if indentation and self.config.dedent_after > 0: - def line_is_empty(line): + def line_is_empty(line: str) -> bool: return not line.strip() empty_lines = takewhile(line_is_empty, reversed(self.buffer)) @@ -942,7 +942,7 @@ def copy2clipboard(self) -> None: else: self.interact.notify(_("Copied content to clipboard.")) - def pastebin(self, s=None) -> str | None: + def pastebin(self, s: str | None = None) -> str | None: """Upload to a pastebin and display the URL in the status bar.""" if s is None: @@ -956,9 +956,8 @@ def pastebin(self, s=None) -> str | None: else: return self.do_pastebin(s) - def do_pastebin(self, s) -> str | None: + def do_pastebin(self, s: str) -> str | None: """Actually perform the upload.""" - paste_url: str if s == self.prev_pastebin_content: self.interact.notify( _("Duplicate pastebin. Previous URL: %s. " "Removal URL: %s") @@ -989,7 +988,7 @@ def do_pastebin(self, s) -> str | None: return paste_url - def push(self, line, insert_into_history=True) -> bool: + def push(self, line: str, insert_into_history: bool = True) -> bool: """Push a line of code onto the buffer so it can process it all at once when a code block ends""" # This push method is used by cli and urwid, but not curtsies From 4697efb6432e1e1de59785f73a554f7e85d59150 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Thu, 26 Mar 2026 14:24:20 +0100 Subject: [PATCH 3/7] Fix test with recent versions of Python 3.13 and 3.14 --- bpython/test/test_interpreter.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bpython/test/test_interpreter.py b/bpython/test/test_interpreter.py index e5bc08956..32082ff87 100644 --- a/bpython/test/test_interpreter.py +++ b/bpython/test/test_interpreter.py @@ -50,7 +50,24 @@ def gfunc(): global_not_found = "name 'gfunc' is not defined" - if (3, 13) <= sys.version_info[:2] or pypy: + if ( + sys.version_info[:2] == (3, 13) + and sys.version_info[:3] >= (3, 13, 12) + ) or sys.version_info[:3] >= (3, 14, 3): + expected = expected = ( + "Traceback (most recent call last):\n File " + + green('""') + + ", line " + + bold(magenta("1")) + + ", in " + + cyan("") + + "\n" + + bold(red("NameError")) + + ": " + + cyan(global_not_found) + + "\n" + ) + elif (3, 13) <= sys.version_info[:2] or pypy: expected = ( "Traceback (most recent call last):\n File " + green('""') From 870e81cb5a6860f1ba15744c81b97f71467eedf9 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Thu, 26 Mar 2026 14:53:38 +0100 Subject: [PATCH 4/7] Fix compatibility of linecache with Python 3.13.12 and Python 3.14.3 --- bpython/patch_linecache.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bpython/patch_linecache.py b/bpython/patch_linecache.py index fa8e17294..78b35684d 100644 --- a/bpython/patch_linecache.py +++ b/bpython/patch_linecache.py @@ -36,6 +36,11 @@ def remember_bpython_input(self, source: str) -> str: ) return filename + def get(self, key: Any, default: Any | None = None) -> Any: + if self.is_bpython_filename(key): + return self.get_bpython_history(key) + return super().get(key, default) + def __getitem__(self, key: Any) -> Any: if self.is_bpython_filename(key): return self.get_bpython_history(key) From 27fc6a0fb2710dc4f4b61a98fa45dd1f62c6bba7 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Thu, 26 Mar 2026 15:45:47 +0100 Subject: [PATCH 5/7] Make test_traceback version agnostic --- bpython/test/test_interpreter.py | 56 ++------------------------------ 1 file changed, 3 insertions(+), 53 deletions(-) diff --git a/bpython/test/test_interpreter.py b/bpython/test/test_interpreter.py index 32082ff87..b9a636dbe 100644 --- a/bpython/test/test_interpreter.py +++ b/bpython/test/test_interpreter.py @@ -48,59 +48,9 @@ def gfunc(): i.runsource("gfunc()") - global_not_found = "name 'gfunc' is not defined" - - if ( - sys.version_info[:2] == (3, 13) - and sys.version_info[:3] >= (3, 13, 12) - ) or sys.version_info[:3] >= (3, 14, 3): - expected = expected = ( - "Traceback (most recent call last):\n File " - + green('""') - + ", line " - + bold(magenta("1")) - + ", in " - + cyan("") - + "\n" - + bold(red("NameError")) - + ": " - + cyan(global_not_found) - + "\n" - ) - elif (3, 13) <= sys.version_info[:2] or pypy: - expected = ( - "Traceback (most recent call last):\n File " - + green('""') - + ", line " - + bold(magenta("1")) - + ", in " - + cyan("") - + "\n gfunc()" - + "\n ^^^^^\n" - + bold(red("NameError")) - + ": " - + cyan(global_not_found) - + "\n" - ) - else: - expected = ( - "Traceback (most recent call last):\n File " - + green('""') - + ", line " - + bold(magenta("1")) - + ", in " - + cyan("") - + "\n gfunc()" - + "\n ^^^^^\n" - + bold(red("NameError")) - + ": " - + cyan(global_not_found) - + "\n" - ) - - a = i.a - self.assertMultiLineEqual(str(expected), str(plain("").join(a))) - self.assertEqual(expected, plain("").join(a)) + a = str(plain("").join(i.a)) + self.assertIn("name 'gfunc' is not defined", a) + self.assertIn("NameErro", a) def test_getsource_works_on_interactively_defined_functions(self): source = "def foo(x):\n return x + 1\n" From c86dbd9335445d0ac0f80db10b205d7326d4e7a4 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Thu, 26 Mar 2026 15:46:17 +0100 Subject: [PATCH 6/7] Remove unused pypy check --- bpython/test/test_interpreter.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/bpython/test/test_interpreter.py b/bpython/test/test_interpreter.py index b9a636dbe..3d40d198c 100644 --- a/bpython/test/test_interpreter.py +++ b/bpython/test/test_interpreter.py @@ -1,12 +1,9 @@ -import sys import unittest from curtsies.fmtfuncs import bold, green, magenta, cyan, red, plain from bpython.curtsiesfrontend import interpreter -pypy = "PyPy" in sys.version - class Interpreter(interpreter.Interp): def __init__(self): From 795453606de4e0b6a13e132ec59a041d5a2e89fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 04:54:10 +0000 Subject: [PATCH 7/7] Bump codecov/codecov-action from 5 to 6 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5 to 6. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v5...v6) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8e04fae2c..1b14b0cd2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -45,7 +45,7 @@ jobs: run: | pytest --cov=bpython --cov-report=xml -v - name: Upload coverage to Codecov - uses: codecov/codecov-action@v5 + uses: codecov/codecov-action@v6 env: PYTHON_VERSION: ${{ matrix.python-version }} with: