Skip to content

Commit d608997

Browse files
committed
Drop Python 2.7 support
Upstream IPython dropped it in version 6.0.0, in April 2017. I think it's fine to drop it here now. Would also be good to use this opportunity to mark the release as 1.0.0.
1 parent 3f41e83 commit d608997

6 files changed

Lines changed: 8 additions & 32 deletions

File tree

HISTORY.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Changelog
44
0.13.10 (unreleased)
55
--------------------
66

7-
- Nothing changed yet.
7+
- Drop Python 2.7 compatibility.
88

99

1010
0.13.9 (2021-06-02)

ipdb/__main__.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# Redistributable under the revised BSD license
55
# https://opensource.org/licenses/BSD-3-Clause
66

7-
from __future__ import print_function
87
import os
98
import sys
109

@@ -16,10 +15,7 @@
1615
from IPython.core.debugger import BdbQuit_excepthook
1716
from IPython.terminal.ipapp import TerminalIPythonApp
1817
from IPython.terminal.embed import InteractiveShellEmbed
19-
try:
20-
import configparser
21-
except:
22-
import ConfigParser as configparser
18+
import configparser
2319

2420

2521
def _get_debugger_cls():
@@ -93,7 +89,7 @@ def get_context_from_config():
9389
)
9490

9591

96-
class ConfigFile(object):
92+
class ConfigFile:
9793
"""
9894
Filehandle wrapper that adds a "[ipdb]" section to the start of a config
9995
file so that users don't actually have to manually add a [ipdb] section.
@@ -255,11 +251,7 @@ def main():
255251
import sys
256252
import getopt
257253

258-
try:
259-
from pdb import Restart
260-
except ImportError:
261-
class Restart(Exception):
262-
pass
254+
from pdb import Restart
263255

264256
if sys.version_info >= (3, 7):
265257
opts, args = getopt.getopt(sys.argv[1:], 'mhc:', ['help', 'command='])

ipdb/stdout.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import print_function
21
import sys
32
from contextlib import contextmanager
43
from IPython.utils import io

setup.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import io
88
import re
9-
from sys import version_info
109

1110
from setuptools import find_packages, setup
1211

@@ -19,18 +18,11 @@
1918
'\n\n' + open('HISTORY.txt').read())
2019

2120

22-
if version_info[0] == 2:
23-
console_script = 'ipdb'
24-
else:
25-
console_script = 'ipdb%d' % version_info.major
26-
27-
2821
setup(name='ipdb',
2922
version=version,
3023
description="IPython-enabled pdb",
3124
long_description=long_description,
3225
classifiers=[
33-
'Programming Language :: Python :: 2.7',
3426
'Programming Language :: Python :: 3',
3527
'Programming Language :: Python :: 3.4',
3628
'Programming Language :: Python :: 3.5',
@@ -54,23 +46,19 @@
5446
include_package_data=True,
5547
zip_safe=True,
5648
test_suite='tests',
57-
python_requires=">=2.7",
49+
python_requires=">=3.4",
5850
install_requires=[
5951
'setuptools',
6052
],
6153
extras_require={
62-
':python_version == "2.7"': ['ipython >= 5.1.0, < 6.0.0', 'toml >= 0.10.2', 'decorator < 5.0.0'],
6354
# No support for python 3.0, 3.1, 3.2.
6455
# FTR, `decorator` is also a dependency of Ipython.
6556
':python_version == "3.4"': ['ipython >= 6.0.0, < 7.0.0', 'toml >= 0.10.2', 'decorator < 5.0.0'],
6657
':python_version == "3.5"': ['ipython >= 7.0.0, < 7.10.0', 'toml >= 0.10.2', 'decorator'],
6758
':python_version == "3.6"': ['ipython >= 7.10.0, < 7.17.0', 'toml >= 0.10.2', 'decorator'],
6859
':python_version > "3.6"': ['ipython >= 7.17.0', 'toml >= 0.10.2', 'decorator'],
6960
},
70-
tests_require=[
71-
'mock; python_version<"3"'
72-
],
7361
entry_points={
74-
'console_scripts': ['%s = ipdb.__main__:main' % console_script]
62+
'console_scripts': ['ipdb3 = ipdb.__main__:main']
7563
}
7664
)

tests/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from ipdb.__main__ import get_config
1616

1717

18-
class ModifiedEnvironment(object):
18+
class ModifiedEnvironment:
1919
"""
2020
I am a context manager that sets up environment variables for a test case.
2121
"""

tests/test_opts.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
# https://opensource.org/licenses/BSD-3-Clause
66

77
import unittest
8-
try:
9-
from unittest.mock import patch
10-
except ImportError:
11-
from mock import patch
8+
from unittest.mock import patch
129

1310
from getopt import GetoptError
1411
from ipdb.__main__ import main

0 commit comments

Comments
 (0)