Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Python 3.7 #8609

Merged
merged 3 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/primer_run_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
timeout-minutes: 120
strategy:
matrix:
python-version: ["3.7", "3.11"]
python-version: ["3.8", "3.11"]
steps:
- name: Check out code from GitHub
uses: actions/checkout@v3.5.2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/primer_run_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
timeout-minutes: 120
strategy:
matrix:
python-version: ["3.7", "3.11"]
python-version: ["3.8", "3.11"]
steps:
- name: Check out code from GitHub
uses: actions/checkout@v3.5.2
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: [3.8, 3.9, "3.10", "3.11"]
outputs:
python-key: ${{ steps.generate-python-key.outputs.key }}
steps:
Expand Down Expand Up @@ -175,7 +175,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: [3.8, 3.9, "3.10", "3.11"]
steps:
- name: Set temp directory
run: echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
fail-fast: false
matrix:
# We only run on the oldest supported version on Mac
python-version: [3.7]
python-version: [3.8]
steps:
- name: Check out code from GitHub
uses: actions/checkout@v3.5.2
Expand Down Expand Up @@ -269,7 +269,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["pypy-3.7", "pypy-3.8", "pypy-3.9"]
python-version: ["pypy-3.8", "pypy-3.9"]
steps:
- name: Check out code from GitHub
uses: actions/checkout@v3.5.2
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repos:
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py38-plus]
exclude: *fixtures
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ What is Pylint?
---------------

Pylint is a `static code analyser`_ for Python 2 or 3. The latest version supports Python
3.7.2 and above.
3.8.0 and above.

.. _`static code analyser`: https://en.wikipedia.org/wiki/Static_code_analysis

Expand Down
7 changes: 1 addition & 6 deletions doc/exts/pylint_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import os
import re
import sys
from typing import Any
from typing import Any, TypedDict

import sphinx
from sphinx.application import Sphinx
Expand All @@ -22,11 +22,6 @@
from pylint.typing import MessageDefinitionTuple, OptionDict, ReportsCallable
from pylint.utils import get_rst_title

if sys.version_info >= (3, 8):
from typing import TypedDict
else:
from typing_extensions import TypedDict


class _CheckerInfo(TypedDict):
"""Represents data about a checker."""
Expand Down
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/6306.breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Remove support for Python 3.7.

Refs #6306
8 changes: 1 addition & 7 deletions pylint/checkers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@

from __future__ import annotations

import sys
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Literal

from pylint.checkers.base_checker import (
BaseChecker,
Expand All @@ -53,11 +52,6 @@
from pylint.checkers.deprecated import DeprecatedMixin
from pylint.utils import LinterStats, diff_string, register_plugins

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal

if TYPE_CHECKING:
from pylint.lint import PyLinter

Expand Down
8 changes: 1 addition & 7 deletions pylint/checkers/base/basic_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

import collections
import itertools
import sys
from collections.abc import Iterator
from typing import TYPE_CHECKING, cast
from typing import TYPE_CHECKING, Literal, cast

import astroid
from astroid import nodes, objects, util
Expand All @@ -24,11 +23,6 @@
if TYPE_CHECKING:
from pylint.lint.pylinter import PyLinter

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal


class _BasicChecker(BaseChecker):
"""Permits separating multiple checks with the same checker name into
Expand Down
7 changes: 1 addition & 6 deletions pylint/checkers/base/docstring_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from __future__ import annotations

import re
import sys
from typing import Literal

import astroid
from astroid import nodes
Expand All @@ -21,11 +21,6 @@
is_property_setter,
)

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal

# do not require a doc string on private/system methods
NO_REQUIRED_DOC_RGX = re.compile("^_")

Expand Down
7 changes: 1 addition & 6 deletions pylint/checkers/classes/class_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from __future__ import annotations

import collections
import sys
from collections import defaultdict
from collections.abc import Callable, Sequence
from functools import cached_property
from itertools import chain, zip_longest
from re import Pattern
from typing import TYPE_CHECKING, Any, Union
Expand Down Expand Up @@ -47,11 +47,6 @@
from pylint.lint.pylinter import PyLinter


if sys.version_info >= (3, 8):
from functools import cached_property
else:
from astroid.decorators import cachedproperty as cached_property

_AccessNodes = Union[nodes.Attribute, nodes.AssignAttr]

INVALID_BASE_CLASSES = {"bool", "range", "slice", "memoryview"}
Expand Down
7 changes: 1 addition & 6 deletions pylint/checkers/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@

from __future__ import annotations

import sys
import tokenize
from functools import reduce
from re import Match
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Literal

from astroid import nodes

Expand All @@ -31,10 +30,6 @@
if TYPE_CHECKING:
from pylint.lint import PyLinter

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal

_KEYWORD_TOKENS = {
"assert",
Expand Down
6 changes: 1 addition & 5 deletions pylint/checkers/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import sys
from collections import defaultdict
from collections.abc import ItemsView, Sequence
from functools import cached_property
from typing import TYPE_CHECKING, Any, Dict, List, Union

import astroid
Expand All @@ -38,11 +39,6 @@
if TYPE_CHECKING:
from pylint.lint import PyLinter

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from astroid.decorators import cachedproperty as cached_property


# The dictionary with Any should actually be a _ImportTree again
# but mypy doesn't support recursive types yet
Expand Down
8 changes: 1 addition & 7 deletions pylint/checkers/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
from __future__ import annotations

import string
import sys
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Literal

import astroid
from astroid import bases, nodes
Expand All @@ -19,11 +18,6 @@
from pylint.checkers.utils import infer_all
from pylint.typing import MessageDefinitionTuple

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal

if TYPE_CHECKING:
from pylint.lint import PyLinter

Expand Down
8 changes: 1 addition & 7 deletions pylint/checkers/raw_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@

from __future__ import annotations

import sys
import tokenize
from typing import TYPE_CHECKING, Any, cast
from typing import TYPE_CHECKING, Any, Literal, cast

from pylint.checkers import BaseTokenChecker
from pylint.reporters.ureports.nodes import Paragraph, Section, Table, Text
from pylint.utils import LinterStats, diff_string

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal

if TYPE_CHECKING:
from pylint.lint import PyLinter

Expand Down
7 changes: 1 addition & 6 deletions pylint/checkers/refactoring/refactoring_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
import collections
import copy
import itertools
import sys
import tokenize
from collections.abc import Iterator
from functools import reduce
from functools import cached_property, reduce
from re import Pattern
from typing import TYPE_CHECKING, Any, NamedTuple, Union, cast

Expand All @@ -27,10 +26,6 @@
if TYPE_CHECKING:
from pylint.lint import PyLinter

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from astroid.decorators import cachedproperty as cached_property

NodesWithNestedBlocks = Union[
nodes.TryExcept, nodes.TryFinally, nodes.While, nodes.For, nodes.If
Expand Down
8 changes: 1 addition & 7 deletions pylint/checkers/spelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,15 @@
from __future__ import annotations

import re
import sys
import tokenize
from re import Pattern
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING, Any, Literal

from astroid import nodes

from pylint.checkers import BaseTokenChecker
from pylint.checkers.utils import only_required_for_messages

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal

if TYPE_CHECKING:
from pylint.lint import PyLinter

Expand Down
8 changes: 1 addition & 7 deletions pylint/checkers/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@

import collections
import re
import sys
import tokenize
from collections import Counter
from collections.abc import Iterable, Sequence
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Literal

import astroid
from astroid import bases, nodes, util
Expand All @@ -26,11 +25,6 @@
if TYPE_CHECKING:
from pylint.lint import PyLinter

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal


_AST_NODE_STR_TYPES = ("__builtin__.unicode", "__builtin__.str", "builtins.str")
# Prefixes for both strings and bytes literals per
Expand Down
11 changes: 2 additions & 9 deletions pylint/checkers/typecheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import sys
import types
from collections.abc import Callable, Iterable, Iterator, Sequence
from functools import singledispatch
from functools import cached_property, singledispatch
from re import Pattern
from typing import TYPE_CHECKING, Any, TypeVar, Union
from typing import TYPE_CHECKING, Any, Literal, TypeVar, Union

import astroid
import astroid.exceptions
Expand Down Expand Up @@ -53,13 +53,6 @@
from pylint.interfaces import HIGH, INFERENCE
from pylint.typing import MessageDefinitionTuple

if sys.version_info >= (3, 8):
from functools import cached_property
from typing import Literal
else:
from astroid.decorators import cachedproperty as cached_property
from typing_extensions import Literal

if TYPE_CHECKING:
from pylint.lint import PyLinter

Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1940,7 +1940,7 @@ def is_typing_member(node: nodes.NodeNG, names_to_check: tuple[str, ...]) -> boo
return False


@lru_cache()
@lru_cache
def in_for_else_branch(parent: nodes.NodeNG, stmt: nodes.Statement) -> bool:
"""Returns True if stmt is inside the else branch for a parent For stmt."""
return isinstance(parent, nodes.For) and any(
Expand Down
Loading