diff --git a/HISTORY.txt b/HISTORY.txt index da89402..3f7fe3a 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -4,7 +4,7 @@ Changelog 0.13.10 (unreleased) -------------------- -- Nothing changed yet. +- Drop Python 2.7 compatibility. 0.13.9 (2021-06-02) diff --git a/ipdb/__main__.py b/ipdb/__main__.py index ea2ae88..f27bf67 100644 --- a/ipdb/__main__.py +++ b/ipdb/__main__.py @@ -4,7 +4,6 @@ # Redistributable under the revised BSD license # https://opensource.org/licenses/BSD-3-Clause -from __future__ import print_function import os import sys @@ -16,10 +15,7 @@ from IPython.core.debugger import BdbQuit_excepthook from IPython.terminal.ipapp import TerminalIPythonApp from IPython.terminal.embed import InteractiveShellEmbed -try: - import configparser -except: - import ConfigParser as configparser +import configparser def _get_debugger_cls(): @@ -93,7 +89,7 @@ def get_context_from_config(): ) -class ConfigFile(object): +class ConfigFile: """ Filehandle wrapper that adds a "[ipdb]" section to the start of a config file so that users don't actually have to manually add a [ipdb] section. @@ -255,11 +251,7 @@ def main(): import sys import getopt - try: - from pdb import Restart - except ImportError: - class Restart(Exception): - pass + from pdb import Restart if sys.version_info >= (3, 7): opts, args = getopt.getopt(sys.argv[1:], 'mhc:', ['help', 'command=']) diff --git a/ipdb/stdout.py b/ipdb/stdout.py index 933aa12..032b776 100644 --- a/ipdb/stdout.py +++ b/ipdb/stdout.py @@ -1,4 +1,3 @@ -from __future__ import print_function import sys from contextlib import contextmanager from IPython.utils import io diff --git a/setup.py b/setup.py index 6ce51c0..10572ca 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,6 @@ import io import re -from sys import version_info from setuptools import find_packages, setup @@ -19,18 +18,11 @@ '\n\n' + open('HISTORY.txt').read()) -if version_info[0] == 2: - console_script = 'ipdb' -else: - console_script = 'ipdb%d' % version_info.major - - setup(name='ipdb', version=version, description="IPython-enabled pdb", long_description=long_description, classifiers=[ - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', @@ -54,12 +46,11 @@ include_package_data=True, zip_safe=True, test_suite='tests', - python_requires=">=2.7", + python_requires=">=3.4", install_requires=[ 'setuptools', ], extras_require={ - ':python_version == "2.7"': ['ipython >= 5.1.0, < 6.0.0', 'toml >= 0.10.2', 'decorator < 5.0.0'], # No support for python 3.0, 3.1, 3.2. # FTR, `decorator` is also a dependency of Ipython. ':python_version == "3.4"': ['ipython >= 6.0.0, < 7.0.0', 'toml >= 0.10.2', 'decorator < 5.0.0'], @@ -67,10 +58,7 @@ ':python_version == "3.6"': ['ipython >= 7.10.0, < 7.17.0', 'toml >= 0.10.2', 'decorator'], ':python_version > "3.6"': ['ipython >= 7.17.0', 'toml >= 0.10.2', 'decorator'], }, - tests_require=[ - 'mock; python_version<"3"' - ], entry_points={ - 'console_scripts': ['%s = ipdb.__main__:main' % console_script] + 'console_scripts': ['ipdb3 = ipdb.__main__:main'] } ) diff --git a/tests/test_config.py b/tests/test_config.py index ff9e272..718d1ab 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -15,7 +15,7 @@ from ipdb.__main__ import get_config -class ModifiedEnvironment(object): +class ModifiedEnvironment: """ I am a context manager that sets up environment variables for a test case. """ diff --git a/tests/test_opts.py b/tests/test_opts.py index 066f64f..3db60c3 100644 --- a/tests/test_opts.py +++ b/tests/test_opts.py @@ -5,10 +5,7 @@ # https://opensource.org/licenses/BSD-3-Clause import unittest -try: - from unittest.mock import patch -except ImportError: - from mock import patch +from unittest.mock import patch from getopt import GetoptError from ipdb.__main__ import main