Skip to content

Commit

Permalink
Require python 3.7.2+ (#5921)
Browse files Browse the repository at this point in the history
* Remove env from tox
* Add changelog
  • Loading branch information
DanielNoord authored Apr 11, 2022
1 parent 06f67b7 commit dfd23f6
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 43 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion doc/development_guide/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion doc/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions doc/whatsnew/2.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 1 addition & 14 deletions pylint/checkers/non_ascii_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,13 @@
The following checkers are intended to make users are aware of these issues.
"""

import sys
from typing import Optional, Union

from astroid import nodes

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"
Expand Down Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion pylint/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 1 addition & 3 deletions pylint/extensions/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions tests/functional/d/deprecated/deprecated_module_py3.rc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[testoptions]
max_pyver=3.6
[typing]
py-version=3.6
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
[testoptions]
min_pyver=3.6.2

[REFACTORING]
never-returning-functions=sys.exit,sys.getdefaultencoding
1 change: 0 additions & 1 deletion tests/functional/i/inherit_non_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions tests/functional/i/inherit_non_class.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit dfd23f6

Please sign in to comment.