Skip to content
Prev Previous commit
Next Next commit
drop 3.11
  • Loading branch information
Carreau committed Feb 2, 2026
commit 4b981b44b0cae89a4f8211fa7c6aca5842f94050
4 changes: 2 additions & 2 deletions IPython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
#-----------------------------------------------------------------------------

# Don't forget to also update setup.py when this changes!
if sys.version_info < (3, 11):
if sys.version_info < (3, 12):
raise ImportError(
"""
IPython 9.x supports Python 3.12 and above, following SPEC0
IPython 8.31+ supports Python 3.11 and above, following SPEC0
IPython 8.19+ supports Python 3.10 and above, following SPEC0.
IPython 8.13+ supports Python 3.9 and above, following NEP 29.
IPython 8.0-8.12 supports Python 3.8 and above, following NEP 29.
When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
Python 3.3 and 3.4 were supported up to IPython 6.x.
Python 3.5 was supported with IPython 7.0 to 7.9.
Expand Down
6 changes: 1 addition & 5 deletions IPython/core/completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,7 @@

from typing import cast

if sys.version_info < (3, 12):
from typing_extensions import TypedDict, Protocol
from typing import NotRequired, TypeAlias, TypeGuard
else:
from typing import TypedDict, NotRequired, Protocol, TypeAlias, TypeGuard
from typing import TypedDict, NotRequired, Protocol, TypeAlias, TypeGuard


# skip module docstests
Expand Down
5 changes: 1 addition & 4 deletions IPython/core/guarded_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@
import types
from typing import Self, LiteralString, get_type_hints

if sys.version_info < (3, 12):
from typing_extensions import TypeAliasType
else:
from typing import TypeAliasType
from typing import TypeAliasType


@undoc
Expand Down
27 changes: 2 additions & 25 deletions IPython/core/inputtransformer2.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,24 +356,8 @@ def transform(self, lines: List[str]):
class SystemAssign(TokenTransformBase):
"""Transformer for assignments from system commands (a = !foo)"""
@classmethod
def find_pre_312(cls, tokens_by_line):
for line in tokens_by_line:
assign_ix = _find_assign_op(line)
if (assign_ix is not None) \
and not line[assign_ix].line.strip().startswith('=') \
and (len(line) >= assign_ix + 2) \
and (line[assign_ix + 1].type == tokenize.ERRORTOKEN):
ix = assign_ix + 1

while ix < len(line) and line[ix].type == tokenize.ERRORTOKEN:
if line[ix].string == '!':
return cls(line[ix].start)
elif not line[ix].string.isspace():
break
ix += 1

@classmethod
def find_post_312(cls, tokens_by_line):
def find(cls, tokens_by_line):
"""Find the first system assignment (a = !foo) in the cell."""
for line in tokens_by_line:
assign_ix = _find_assign_op(line)
if (
Expand All @@ -385,13 +369,6 @@ def find_post_312(cls, tokens_by_line):
):
return cls(line[assign_ix + 1].start)

@classmethod
def find(cls, tokens_by_line):
"""Find the first system assignment (a = !foo) in the cell."""
if sys.version_info < (3, 12):
return cls.find_pre_312(tokens_by_line)
return cls.find_post_312(tokens_by_line)

def transform(self, lines: List[str]):
"""Transform a system assignment found by the ``find()`` classmethod.
"""
Expand Down
3 changes: 1 addition & 2 deletions IPython/core/interactiveshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -2118,8 +2118,7 @@ def _get_exc_info(self, exc_tuple=None):
sys.last_type = etype
sys.last_value = value
sys.last_traceback = tb
if sys.version_info >= (3, 12):
sys.last_exc = value
sys.last_exc = value

return etype, value, tb

Expand Down
6 changes: 1 addition & 5 deletions IPython/core/ultratb.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,11 +961,7 @@ def debugger(self, force: bool = False) -> None:
self.pdb.botframe = etb.tb_frame
# last_value should be deprecated, but last-exc sometimme not set
# please check why later and remove the getattr.
exc = (
sys.last_value
if sys.version_info < (3, 12)
else getattr(sys, "last_exc", sys.last_value)
) # type: ignore[attr-defined]
exc = getattr(sys, "last_exc", sys.last_value)
if exc:
self.pdb.interaction(None, exc)
else:
Expand Down
5 changes: 1 addition & 4 deletions IPython/utils/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@
)
from collections.abc import Sequence, Mapping, Callable, Iterator

if sys.version_info < (3, 12):
from typing import Self
else:
from typing import Self
from typing import Self


class LSString(str):
Expand Down
13 changes: 0 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,6 @@
#
# This check is also made in IPython/__init__, don't forget to update both when
# changing Python version requirements.
if sys.version_info < (3, 11):
pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.'
try:
import pip
pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]])
if pip_version < (9, 0, 1) :
pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\
'pip {} detected.'.format(pip.__version__)
else:
# pip is new enough - it must be something else
pip_message = ''
except Exception:
pass


error = """
Expand Down
5 changes: 1 addition & 4 deletions tests/test_guarded_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@

from typing import Self, LiteralString

if sys.version_info < (3, 12):
from typing_extensions import TypeAliasType
else:
from typing import TypeAliasType
from typing import TypeAliasType


def create_context(evaluation: str, **kwargs):
Expand Down
3 changes: 1 addition & 2 deletions tests/test_zzz_autoreload.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,7 @@ class TestEnum(Enum):
self.shell.run_code("assert func2() == 'changed'")
self.shell.run_code("t = Test(); assert t.new_func() == 'changed'")
self.shell.run_code("assert number == 1")
if sys.version_info < (3, 12):
self.shell.run_code("assert TestEnum.B.value == 'added'")
self.shell.run_code("assert TestEnum.B.value == 'added'")
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.shell.run_code("assert TestEnum.B.value == 'added'")


# ----------- TEST IMPORT FROM MODULE --------------------------

Expand Down