Skip to content

Commit b87034d

Browse files
authored
Merge pull request #1741 from PyCQA/drop-py37
require python 3.8.1+
2 parents 16c371d + aa002ee commit b87034d

File tree

12 files changed

+70
-94
lines changed

12 files changed

+70
-94
lines changed

.github/workflows/main.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ jobs:
1313
include:
1414
# linux
1515
- os: ubuntu-latest
16-
python: pypy-3.7
17-
toxenv: py
18-
- os: ubuntu-latest
19-
python: 3.7
16+
python: pypy-3.8
2017
toxenv: py
2118
- os: ubuntu-latest
2219
python: 3.8
@@ -25,21 +22,24 @@ jobs:
2522
python: 3.9
2623
toxenv: py
2724
- os: ubuntu-latest
28-
python: '3.10.0-alpha - 3.10.999'
25+
python: '3.10'
26+
toxenv: py
27+
- os: ubuntu-latest
28+
python: '3.11'
2929
toxenv: py
3030
# windows
3131
- os: windows-latest
32-
python: 3.7
32+
python: 3.8
3333
toxenv: py
3434
# misc
3535
- os: ubuntu-latest
36-
python: 3.9
36+
python: '3.10'
3737
toxenv: docs
3838
- os: ubuntu-latest
39-
python: 3.9
39+
python: '3.10'
4040
toxenv: linters
4141
- os: ubuntu-latest
42-
python: 3.9
42+
python: '3.10'
4343
toxenv: dogfood
4444
runs-on: ${{ matrix.os }}
4545
steps:

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ repos:
1313
- id: reorder-python-imports
1414
args: [
1515
--application-directories, '.:src',
16-
--py37-plus,
16+
--py38-plus,
1717
--add-import, 'from __future__ import annotations',
1818
]
1919
- repo: https://github.com/asottile/pyupgrade
2020
rev: v3.2.2
2121
hooks:
2222
- id: pyupgrade
23-
args: [--py37-plus]
23+
args: [--py38-plus]
2424
- repo: https://github.com/psf/black
2525
rev: 22.10.0
2626
hooks:

setup.cfg

+2-6
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ classifiers =
2020
Programming Language :: Python
2121
Programming Language :: Python :: 3
2222
Programming Language :: Python :: 3 :: Only
23-
Programming Language :: Python :: 3.7
24-
Programming Language :: Python :: 3.8
25-
Programming Language :: Python :: 3.9
26-
Programming Language :: Python :: 3.10
2723
Programming Language :: Python :: Implementation :: CPython
2824
Programming Language :: Python :: Implementation :: PyPy
2925
Topic :: Software Development :: Libraries :: Python Modules
@@ -41,8 +37,8 @@ install_requires =
4137
mccabe>=0.7.0,<0.8.0
4238
pycodestyle>=2.9.0,<2.10.0
4339
pyflakes>=2.5.0,<2.6.0
44-
importlib-metadata>=1.1.0,<4.3;python_version<"3.8"
45-
python_requires = >=3.7
40+
# 3.8.0's importlib.metadata is broken
41+
python_requires = >=3.8.1
4642

4743
[options.packages.find]
4844
where = src

src/flake8/_compat.py

-18
This file was deleted.

src/flake8/plugins/finder.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import annotations
33

44
import configparser
5+
import importlib.metadata
56
import inspect
67
import itertools
78
import logging
@@ -12,7 +13,6 @@
1213
from typing import NamedTuple
1314

1415
from flake8 import utils
15-
from flake8._compat import importlib_metadata
1616
from flake8.defaults import VALID_CODE_PREFIX
1717
from flake8.exceptions import ExecutionError
1818
from flake8.exceptions import FailedToLoadPlugin
@@ -32,7 +32,7 @@ class Plugin(NamedTuple):
3232

3333
package: str
3434
version: str
35-
entry_point: importlib_metadata.EntryPoint
35+
entry_point: importlib.metadata.EntryPoint
3636

3737

3838
class LoadedPlugin(NamedTuple):
@@ -148,12 +148,12 @@ def parse_plugin_options(
148148

149149

150150
def _flake8_plugins(
151-
eps: Iterable[importlib_metadata.EntryPoint],
151+
eps: Iterable[importlib.metadata.EntryPoint],
152152
name: str,
153153
version: str,
154154
) -> Generator[Plugin, None, None]:
155-
pyflakes_meta = importlib_metadata.distribution("pyflakes").metadata
156-
pycodestyle_meta = importlib_metadata.distribution("pycodestyle").metadata
155+
pyflakes_meta = importlib.metadata.distribution("pyflakes").metadata
156+
pycodestyle_meta = importlib.metadata.distribution("pycodestyle").metadata
157157

158158
for ep in eps:
159159
if ep.group not in FLAKE8_GROUPS:
@@ -176,7 +176,7 @@ def _flake8_plugins(
176176
def _find_importlib_plugins() -> Generator[Plugin, None, None]:
177177
# some misconfigured pythons (RHEL) have things on `sys.path` twice
178178
seen = set()
179-
for dist in importlib_metadata.distributions():
179+
for dist in importlib.metadata.distributions():
180180
# assigned to prevent continual reparsing
181181
eps = dist.entry_points
182182

@@ -221,7 +221,7 @@ def _find_local_plugins(
221221
):
222222
name, _, entry_str = plugin_s.partition("=")
223223
name, entry_str = name.strip(), entry_str.strip()
224-
ep = importlib_metadata.EntryPoint(name, entry_str, group)
224+
ep = importlib.metadata.EntryPoint(name, entry_str, group)
225225
yield Plugin("local", "local", ep)
226226

227227

tests/integration/test_checker.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""Integration tests for the checker submodule."""
22
from __future__ import annotations
33

4+
import importlib.metadata
45
import sys
56
from unittest import mock
67

78
import pytest
89

910
from flake8 import checker
10-
from flake8._compat import importlib_metadata
1111
from flake8.plugins import finder
1212
from flake8.processor import FileProcessor
1313

@@ -85,7 +85,7 @@ def mock_file_checker_with_plugin(plugin_target):
8585
finder.Plugin(
8686
"flake-package",
8787
"9001",
88-
importlib_metadata.EntryPoint(
88+
importlib.metadata.EntryPoint(
8989
"Q",
9090
f"{plugin_target.__module__}:{plugin_target.__name__}",
9191
"flake8.extension",

tests/integration/test_main.py

-2
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ def test_tokenization_error_but_not_syntax_error(tmpdir, capsys):
170170

171171
if hasattr(sys, "pypy_version_info"): # pragma: no cover (pypy)
172172
expected = "t.py:2:1: E999 SyntaxError: end of file (EOF) in multi-line statement\n" # noqa: E501
173-
elif sys.version_info < (3, 8): # pragma: no cover (<cp38)
174-
expected = "t.py:2:1: E902 TokenError: EOF in multi-line statement\n"
175173
elif sys.version_info < (3, 10): # pragma: no cover (cp38+)
176174
expected = "t.py:1:8: E999 SyntaxError: unexpected EOF while parsing\n"
177175
else: # pragma: no cover (cp310+)

0 commit comments

Comments
 (0)