From dfd23f61d5da4d8531a10f0d829ab5b05bce292e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Mon, 11 Apr 2022 15:22:18 +0200 Subject: [PATCH] Require python ``3.7.2+`` (#5921) * Remove env from tox * Add changelog --- .github/workflows/tests.yaml | 6 +++--- ChangeLog | 4 ++++ README.rst | 2 +- doc/development_guide/testing.rst | 2 +- doc/faq.rst | 2 +- doc/whatsnew/2.14.rst | 4 ++++ pylint/checkers/non_ascii_names.py | 15 +-------------- pylint/constants.py | 1 - pylint/extensions/typing.py | 4 +--- requirements_test.txt | 2 +- setup.cfg | 3 +-- .../deprecated/deprecated_method_getmoduleinfo.py | 4 ---- .../deprecated/deprecated_method_getmoduleinfo.rc | 2 -- .../deprecated_method_getmoduleinfo.txt | 1 - .../d/deprecated/deprecated_module_py3.rc | 4 ++-- .../inconsistent/inconsistent_returns_noreturn.rc | 3 --- tests/functional/i/inherit_non_class.py | 1 - tests/functional/i/inherit_non_class.txt | 4 ++-- tox.ini | 2 +- 19 files changed, 23 insertions(+), 43 deletions(-) delete mode 100644 tests/functional/d/deprecated/deprecated_method_getmoduleinfo.py delete mode 100644 tests/functional/d/deprecated/deprecated_method_getmoduleinfo.rc delete mode 100644 tests/functional/d/deprecated/deprecated_method_getmoduleinfo.txt diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 49bb2f3705..05832e02df 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] + python-version: [3.7, 3.8, 3.9, "3.10"] outputs: python-key: ${{ steps.generate-python-key.outputs.key }} steps: @@ -172,7 +172,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] + python-version: [3.7, 3.8, 3.9, "3.10"] outputs: python-key: ${{ steps.generate-python-key.outputs.key }} steps: @@ -224,7 +224,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["pypy-3.6", "pypy-3.7"] + python-version: ["pypy-3.7"] outputs: python-key: ${{ steps.generate-python-key.outputs.key }} steps: diff --git a/ChangeLog b/ChangeLog index b9f497c89f..b87af0217d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,10 @@ Release date: TBA .. Put new features here and also in 'doc/whatsnew/2.14.rst' +* ``Pylint`` now requires Python 3.7.2 or newer to run. + + Closes #4301 + * ``BaseChecker`` classes now require the ``linter`` argument to be passed. * Update ``invalid-slots-object`` message to show bad object rather than its inferred value. diff --git a/README.rst b/README.rst index 9e4da34d8a..aef1e34f1a 100644 --- a/README.rst +++ b/README.rst @@ -74,7 +74,7 @@ Pylint can be simply installed by running:: pip install pylint -If you are using Python 3.6.2+, upgrade to get full support for your version:: +If you are using Python 3.7.2+, upgrade to get full support for your version:: pip install pylint --upgrade diff --git a/doc/development_guide/testing.rst b/doc/development_guide/testing.rst index af14ad4aba..fa0a988d51 100644 --- a/doc/development_guide/testing.rst +++ b/doc/development_guide/testing.rst @@ -32,7 +32,7 @@ Before writing a new test it is often a good idea to ensure that your change isn breaking a current test. You can run our tests using the tox_ package, as in:: python -m tox - python -m tox -epy36 # for Python 3.6 suite only + python -m tox -epy38 # for Python 3.8 suite only python -m tox -epylint # for running Pylint over Pylint's codebase python -m tox -eformatting # for running formatting checks over Pylint's codebase diff --git a/doc/faq.rst b/doc/faq.rst index de7288ae56..8d5dbccdc4 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -48,7 +48,7 @@ supported. 2.4 What versions of Python is Pylint supporting? -------------------------------------------------- -The supported running environment since Pylint 2.12.1 is Python 3.6.2+. +The supported running environment since Pylint 2.14.0 is Python 3.7.2+. 3. Running Pylint diff --git a/doc/whatsnew/2.14.rst b/doc/whatsnew/2.14.rst index 4d4a0ff545..6f9e312fdd 100644 --- a/doc/whatsnew/2.14.rst +++ b/doc/whatsnew/2.14.rst @@ -60,6 +60,10 @@ Extensions Other Changes ============= +* ``Pylint`` now requires Python 3.7.2 or newer to run. + + Closes #4301 + * Update ``invalid-slots-object`` message to show bad object rather than its inferred value. Closes #6101 diff --git a/pylint/checkers/non_ascii_names.py b/pylint/checkers/non_ascii_names.py index 29de8449ec..78dc12ac05 100644 --- a/pylint/checkers/non_ascii_names.py +++ b/pylint/checkers/non_ascii_names.py @@ -10,7 +10,6 @@ The following checkers are intended to make users are aware of these issues. """ -import sys from typing import Optional, Union from astroid import nodes @@ -18,18 +17,6 @@ from pylint import constants, interfaces, lint from pylint.checkers import base_checker, utils -if sys.version_info[:2] >= (3, 7): - # pylint: disable-next=fixme - # TODO: Remove after 3.6 has been deprecated - Py37Str = str -else: - - class Py37Str(str): - # Allow Python 3.6 compatibility - def isascii(self: str) -> bool: - return all("\u0000" <= x <= "\u007F" for x in self) - - NON_ASCII_HELP = ( "Used when the name contains at least one non-ASCII unicode character. " "See https://www.python.org/dev/peps/pep-0672/#confusable-characters-in-identifiers" @@ -95,7 +82,7 @@ def _check_name( # For some nodes i.e. *kwargs from a dict, the name will be empty return - if not (Py37Str(name).isascii()): + if not str(name).isascii(): type_label = constants.HUMAN_READABLE_TYPES[node_type] args = (type_label.capitalize(), name) diff --git a/pylint/constants.py b/pylint/constants.py index 84cb6dc223..5428afe0c2 100644 --- a/pylint/constants.py +++ b/pylint/constants.py @@ -13,7 +13,6 @@ from pylint.__pkginfo__ import __version__ from pylint.typing import MessageTypesFullName -PY37_PLUS = sys.version_info[:2] >= (3, 7) PY38_PLUS = sys.version_info[:2] >= (3, 8) PY39_PLUS = sys.version_info[:2] >= (3, 9) diff --git a/pylint/extensions/typing.py b/pylint/extensions/typing.py index 12ccfdffcb..b29b58cf61 100644 --- a/pylint/extensions/typing.py +++ b/pylint/extensions/typing.py @@ -367,12 +367,10 @@ def _check_broken_noreturn(self, node: Union[nodes.Name, nodes.Attribute]) -> No if ( isinstance(inferred, (nodes.FunctionDef, nodes.ClassDef)) and inferred.qname() in TYPING_NORETURN - # In Python 3.6, NoReturn is alias of '_NoReturn' # In Python 3.7 - 3.8, NoReturn is alias of '_SpecialForm' or isinstance(inferred, astroid.bases.BaseInstance) and isinstance(inferred._proxied, nodes.ClassDef) - and inferred._proxied.qname() - in {"typing._NoReturn", "typing._SpecialForm"} + and inferred._proxied.qname() == "typing._SpecialForm" ): self.add_message("broken-noreturn", node=node, confidence=INFERENCE) break diff --git a/requirements_test.txt b/requirements_test.txt index 2e35f584d2..c1588ba409 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -2,7 +2,7 @@ -r requirements_test_min.txt coveralls~=3.3 coverage~=6.2 -pre-commit~=2.17;python_full_version>="3.6.2" +pre-commit~=2.17 tbump~=6.6.0 contributors-txt>=0.7.3 pyenchant~=3.2 diff --git a/setup.cfg b/setup.cfg index 0b2e743529..5714bfd3c7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,6 @@ classifiers = Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 @@ -54,7 +53,7 @@ install_requires = tomli>=1.1.0;python_version<"3.11" colorama;sys_platform=="win32" typing-extensions>=3.10.0;python_version<"3.10" -python_requires = >=3.6.2 +python_requires = >=3.7.2 [options.extras_require] testutil=gitpython>3 diff --git a/tests/functional/d/deprecated/deprecated_method_getmoduleinfo.py b/tests/functional/d/deprecated/deprecated_method_getmoduleinfo.py deleted file mode 100644 index 3338c2456f..0000000000 --- a/tests/functional/d/deprecated/deprecated_method_getmoduleinfo.py +++ /dev/null @@ -1,4 +0,0 @@ -"""Test that getmoduleinfo is deprecated.""" -import inspect - -inspect.getmoduleinfo(inspect) # [deprecated-method] diff --git a/tests/functional/d/deprecated/deprecated_method_getmoduleinfo.rc b/tests/functional/d/deprecated/deprecated_method_getmoduleinfo.rc deleted file mode 100644 index 83cd04143f..0000000000 --- a/tests/functional/d/deprecated/deprecated_method_getmoduleinfo.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -max_pyver=3.6 diff --git a/tests/functional/d/deprecated/deprecated_method_getmoduleinfo.txt b/tests/functional/d/deprecated/deprecated_method_getmoduleinfo.txt deleted file mode 100644 index 77632a1571..0000000000 --- a/tests/functional/d/deprecated/deprecated_method_getmoduleinfo.txt +++ /dev/null @@ -1 +0,0 @@ -deprecated-method:4:::Using deprecated method getmoduleinfo() diff --git a/tests/functional/d/deprecated/deprecated_module_py3.rc b/tests/functional/d/deprecated/deprecated_module_py3.rc index 83cd04143f..375b36140e 100644 --- a/tests/functional/d/deprecated/deprecated_module_py3.rc +++ b/tests/functional/d/deprecated/deprecated_module_py3.rc @@ -1,2 +1,2 @@ -[testoptions] -max_pyver=3.6 +[typing] +py-version=3.6 diff --git a/tests/functional/i/inconsistent/inconsistent_returns_noreturn.rc b/tests/functional/i/inconsistent/inconsistent_returns_noreturn.rc index bf9569ba24..dd6cbb5989 100644 --- a/tests/functional/i/inconsistent/inconsistent_returns_noreturn.rc +++ b/tests/functional/i/inconsistent/inconsistent_returns_noreturn.rc @@ -1,5 +1,2 @@ -[testoptions] -min_pyver=3.6.2 - [REFACTORING] never-returning-functions=sys.exit,sys.getdefaultencoding diff --git a/tests/functional/i/inherit_non_class.py b/tests/functional/i/inherit_non_class.py index 7454744d9b..e741c73537 100644 --- a/tests/functional/i/inherit_non_class.py +++ b/tests/functional/i/inherit_non_class.py @@ -92,7 +92,6 @@ def __class_getitem__(cls, item): # pylint: disable=unused-argument return 42 # pylint: disable-next=fixme -# TODO This should emit 'unsubscriptable-object' for Python 3.6 class Child1(ParentGood[int]): pass diff --git a/tests/functional/i/inherit_non_class.txt b/tests/functional/i/inherit_non_class.txt index 4f90838329..2e94b4001f 100644 --- a/tests/functional/i/inherit_non_class.txt +++ b/tests/functional/i/inherit_non_class.txt @@ -7,5 +7,5 @@ inherit-non-class:68:0:68:24:NotInheritableBool:Inheriting 'bool', which is not inherit-non-class:72:0:72:25:NotInheritableRange:Inheriting 'range', which is not a class.:UNDEFINED inherit-non-class:76:0:76:25:NotInheritableSlice:Inheriting 'slice', which is not a class.:UNDEFINED inherit-non-class:80:0:80:30:NotInheritableMemoryView:Inheriting 'memoryview', which is not a class.:UNDEFINED -inherit-non-class:99:0:99:12:Child2:Inheriting 'ParentBad[int]', which is not a class.:UNDEFINED -unsubscriptable-object:103:13:103:18:Child3:Value 'Empty' is unsubscriptable:UNDEFINED +inherit-non-class:98:0:98:12:Child2:Inheriting 'ParentBad[int]', which is not a class.:UNDEFINED +unsubscriptable-object:102:13:102:18:Child3:Value 'Empty' is unsubscriptable:UNDEFINED diff --git a/tox.ini b/tox.ini index 550bbf1664..0f3192e27a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 2.4 -envlist = formatting, py36, py37, py38, py39, py310, pypy, benchmark +envlist = formatting, py37, py38, py39, py310, pypy, benchmark skip_missing_interpreters = true requires = pip >=21.3.1