Skip to content

Commit 9d55ccd

Browse files
committed
py39+
1 parent e492aeb commit 9d55ccd

22 files changed

+64
-78
lines changed

.github/workflows/main.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ jobs:
1515
- os: ubuntu-latest
1616
python: pypy-3.9
1717
toxenv: py
18-
- os: ubuntu-latest
19-
python: 3.8
20-
toxenv: py
2118
- os: ubuntu-latest
2219
python: 3.9
2320
toxenv: py
@@ -28,11 +25,14 @@ jobs:
2825
python: '3.11'
2926
toxenv: py
3027
- os: ubuntu-latest
31-
python: '3.12-dev'
28+
python: '3.12'
29+
toxenv: py
30+
- os: ubuntu-latest
31+
python: '3.13'
3232
toxenv: py
3333
# windows
3434
- os: windows-latest
35-
python: 3.8
35+
python: 3.9
3636
toxenv: py
3737
# misc
3838
- os: ubuntu-latest

.pre-commit-config.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ repos:
1212
hooks:
1313
- id: setup-cfg-fmt
1414
- repo: https://github.com/asottile/reorder-python-imports
15-
rev: v3.12.0
15+
rev: v3.14.0
1616
hooks:
1717
- id: reorder-python-imports
1818
args: [
1919
--application-directories, '.:src',
20-
--py38-plus,
20+
--py39-plus,
2121
--add-import, 'from __future__ import annotations',
2222
]
2323
- repo: https://github.com/asottile/pyupgrade
24-
rev: v3.15.0
24+
rev: v3.19.1
2525
hooks:
2626
- id: pyupgrade
27-
args: [--py38-plus]
27+
args: [--py39-plus]
2828
- repo: https://github.com/psf/black
2929
rev: 23.12.1
3030
hooks:
@@ -35,7 +35,7 @@ repos:
3535
hooks:
3636
- id: flake8
3737
- repo: https://github.com/pre-commit/mirrors-mypy
38-
rev: v1.8.0
38+
rev: v1.15.0
3939
hooks:
4040
- id: mypy
4141
exclude: ^(docs/|example-plugin/)

bin/gen-pycodestyle-plugin

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ from __future__ import annotations
33

44
import inspect
55
import os.path
6+
from collections.abc import Generator
67
from typing import Any
78
from typing import Callable
8-
from typing import Generator
99
from typing import NamedTuple
1010

1111
import pycodestyle
@@ -42,7 +42,7 @@ class Call(NamedTuple):
4242
return cls(func.__name__, inspect.isgeneratorfunction(func), params)
4343

4444

45-
def lines() -> Generator[str, None, None]:
45+
def lines() -> Generator[str]:
4646
logical = []
4747
physical = []
4848

@@ -58,8 +58,8 @@ def lines() -> Generator[str, None, None]:
5858
yield "# fmt: off"
5959
yield "from __future__ import annotations"
6060
yield ""
61+
yield "from collections.abc import Generator"
6162
yield "from typing import Any"
62-
yield "from typing import Generator"
6363
yield ""
6464
imports = sorted(call.name for call in logical + physical)
6565
for name in imports:
@@ -71,7 +71,7 @@ def lines() -> Generator[str, None, None]:
7171
logical_params = {param for call in logical for param in call.params}
7272
for param in sorted(logical_params):
7373
yield f" {param}: Any,"
74-
yield ") -> Generator[tuple[int, str], None, None]:"
74+
yield ") -> Generator[tuple[int, str]]:"
7575
yield ' """Run pycodestyle logical checks."""'
7676
for call in sorted(logical):
7777
yield call.to_src()
@@ -82,7 +82,7 @@ def lines() -> Generator[str, None, None]:
8282
physical_params = {param for call in physical for param in call.params}
8383
for param in sorted(physical_params):
8484
yield f" {param}: Any,"
85-
yield ") -> Generator[tuple[int, str], None, None]:"
85+
yield ") -> Generator[tuple[int, str]]:"
8686
yield ' """Run pycodestyle physical checks."""'
8787
for call in sorted(physical):
8888
yield call.to_src()

docs/source/internal/releases.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ for users.
8181

8282
Before releasing, the following tox test environments must pass:
8383

84-
- Python 3.8 (a.k.a., ``tox -e py38``)
84+
- Python 3.9 (a.k.a., ``tox -e py39``)
8585

86-
- Python 3.12 (a.k.a., ``tox -e py312``)
86+
- Python 3.13 (a.k.a., ``tox -e py313``)
8787

8888
- PyPy 3 (a.k.a., ``tox -e pypy3``)
8989

docs/source/user/invocation.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@ like so:
1414

1515
Where you simply allow the shell running in your terminal to locate |Flake8|.
1616
In some cases, though, you may have installed |Flake8| for multiple versions
17-
of Python (e.g., Python 3.8 and Python 3.9) and you need to call a specific
17+
of Python (e.g., Python 3.13 and Python 3.14) and you need to call a specific
1818
version. In that case, you will have much better results using:
1919

2020
.. prompt:: bash
2121

22-
python3.8 -m flake8
22+
python3.13 -m flake8
2323

2424
Or
2525

2626
.. prompt:: bash
2727

28-
python3.9 -m flake8
28+
python3.14 -m flake8
2929

3030
Since that will tell the correct version of Python to run |Flake8|.
3131

3232
.. note::
3333

34-
Installing |Flake8| once will not install it on both Python 3.8 and
35-
Python 3.9. It will only install it for the version of Python that
34+
Installing |Flake8| once will not install it on both Python 3.13 and
35+
Python 3.14. It will only install it for the version of Python that
3636
is running pip.
3737

3838
It is also possible to specify command-line options directly to |Flake8|:

example-plugin/setup.py

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
"License :: OSI Approved :: MIT License",
2424
"Programming Language :: Python",
2525
"Programming Language :: Python :: 3",
26-
"Programming Language :: Python :: 3.8",
27-
"Programming Language :: Python :: 3.9",
2826
"Topic :: Software Development :: Libraries :: Python Modules",
2927
"Topic :: Software Development :: Quality Assurance",
3028
],

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ install_requires =
3131
mccabe>=0.7.0,<0.8.0
3232
pycodestyle>=2.12.0,<2.13.0
3333
pyflakes>=3.2.0,<3.3.0
34-
python_requires = >=3.8.1
34+
python_requires = >=3.9
3535
package_dir =
3636
=src
3737

src/flake8/checker.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99
import operator
1010
import signal
1111
import tokenize
12+
from collections.abc import Generator
13+
from collections.abc import Sequence
1214
from typing import Any
13-
from typing import Generator
14-
from typing import List
1515
from typing import Optional
16-
from typing import Sequence
17-
from typing import Tuple
1816

1917
from flake8 import defaults
2018
from flake8 import exceptions
@@ -27,7 +25,7 @@
2725
from flake8.plugins.finder import LoadedPlugin
2826
from flake8.style_guide import StyleGuideManager
2927

30-
Results = List[Tuple[str, int, int, str, Optional[str]]]
28+
Results = list[tuple[str, int, int, str, Optional[str]]]
3129

3230
LOG = logging.getLogger(__name__)
3331

@@ -53,7 +51,7 @@
5351
@contextlib.contextmanager
5452
def _mp_prefork(
5553
plugins: Checkers, options: argparse.Namespace
56-
) -> Generator[None, None, None]:
54+
) -> Generator[None]:
5755
# we can save significant startup work w/ `fork` multiprocessing
5856
global _mp_plugins, _mp_options
5957
_mp_plugins, _mp_options = plugins, options

src/flake8/discover_files.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
import logging
55
import os.path
6+
from collections.abc import Generator
7+
from collections.abc import Sequence
68
from typing import Callable
7-
from typing import Generator
8-
from typing import Sequence
99

1010
from flake8 import utils
1111

@@ -16,7 +16,7 @@ def _filenames_from(
1616
arg: str,
1717
*,
1818
predicate: Callable[[str], bool],
19-
) -> Generator[str, None, None]:
19+
) -> Generator[str]:
2020
"""Generate filenames from an argument.
2121
2222
:param arg:
@@ -55,7 +55,7 @@ def expand_paths(
5555
stdin_display_name: str,
5656
filename_patterns: Sequence[str],
5757
exclude: Sequence[str],
58-
) -> Generator[str, None, None]:
58+
) -> Generator[str]:
5959
"""Expand out ``paths`` from commandline to the lintable files."""
6060
if not paths:
6161
paths = ["."]

src/flake8/main/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import json
66
import logging
77
import time
8-
from typing import Sequence
8+
from collections.abc import Sequence
99

1010
import flake8
1111
from flake8 import checker

src/flake8/main/cli.py

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

44
import sys
5-
from typing import Sequence
5+
from collections.abc import Sequence
66

77
from flake8.main import application
88

src/flake8/options/aggregator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import argparse
99
import configparser
1010
import logging
11-
from typing import Sequence
11+
from collections.abc import Sequence
1212

1313
from flake8.options import config
1414
from flake8.options.manager import OptionManager

src/flake8/options/manager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import enum
66
import functools
77
import logging
8+
from collections.abc import Sequence
89
from typing import Any
910
from typing import Callable
10-
from typing import Sequence
1111

1212
from flake8 import utils
1313
from flake8.plugins.finder import Plugins

src/flake8/options/parse_args.py

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

44
import argparse
5-
from typing import Sequence
5+
from collections.abc import Sequence
66

77
import flake8
88
from flake8.main import options

src/flake8/plugins/finder.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
import itertools
88
import logging
99
import sys
10+
from collections.abc import Generator
11+
from collections.abc import Iterable
1012
from typing import Any
11-
from typing import Generator
12-
from typing import Iterable
1313
from typing import NamedTuple
1414

1515
from flake8 import utils
@@ -68,7 +68,7 @@ class Plugins(NamedTuple):
6868
reporters: dict[str, LoadedPlugin]
6969
disabled: list[LoadedPlugin]
7070

71-
def all_plugins(self) -> Generator[LoadedPlugin, None, None]:
71+
def all_plugins(self) -> Generator[LoadedPlugin]:
7272
"""Return an iterator over all :class:`LoadedPlugin`s."""
7373
yield from self.checkers.tree
7474
yield from self.checkers.logical_line
@@ -151,7 +151,7 @@ def _flake8_plugins(
151151
eps: Iterable[importlib.metadata.EntryPoint],
152152
name: str,
153153
version: str,
154-
) -> Generator[Plugin, None, None]:
154+
) -> Generator[Plugin]:
155155
pyflakes_meta = importlib.metadata.distribution("pyflakes").metadata
156156
pycodestyle_meta = importlib.metadata.distribution("pycodestyle").metadata
157157

@@ -173,7 +173,7 @@ def _flake8_plugins(
173173
yield Plugin(name, version, ep)
174174

175175

176-
def _find_importlib_plugins() -> Generator[Plugin, None, None]:
176+
def _find_importlib_plugins() -> Generator[Plugin]:
177177
# some misconfigured pythons (RHEL) have things on `sys.path` twice
178178
seen = set()
179179
for dist in importlib.metadata.distributions():
@@ -212,7 +212,7 @@ def _find_importlib_plugins() -> Generator[Plugin, None, None]:
212212

213213
def _find_local_plugins(
214214
cfg: configparser.RawConfigParser,
215-
) -> Generator[Plugin, None, None]:
215+
) -> Generator[Plugin]:
216216
for plugin_type in ("extension", "report"):
217217
group = f"flake8.{plugin_type}"
218218
for plugin_s in utils.parse_comma_separated_list(

src/flake8/plugins/pycodestyle.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# fmt: off
33
from __future__ import annotations
44

5+
from collections.abc import Generator
56
from typing import Any
6-
from typing import Generator
77

88
from pycodestyle import ambiguous_identifier as _ambiguous_identifier
99
from pycodestyle import bare_except as _bare_except
@@ -55,7 +55,7 @@ def pycodestyle_logical(
5555
previous_unindented_logical_line: Any,
5656
tokens: Any,
5757
verbose: Any,
58-
) -> Generator[tuple[int, str], None, None]:
58+
) -> Generator[tuple[int, str]]:
5959
"""Run pycodestyle logical checks."""
6060
yield from _ambiguous_identifier(logical_line, tokens)
6161
yield from _bare_except(logical_line, noqa)
@@ -93,7 +93,7 @@ def pycodestyle_physical(
9393
noqa: Any,
9494
physical_line: Any,
9595
total_lines: Any,
96-
) -> Generator[tuple[int, str], None, None]:
96+
) -> Generator[tuple[int, str]]:
9797
"""Run pycodestyle physical checks."""
9898
ret = _maximum_line_length(physical_line, max_line_length, multiline, line_number, noqa) # noqa: E501
9999
if ret is not None:

src/flake8/plugins/pyflakes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import argparse
55
import ast
66
import logging
7+
from collections.abc import Generator
78
from typing import Any
8-
from typing import Generator
99

1010
import pyflakes.checker
1111

@@ -97,7 +97,7 @@ def parse_options(cls, options: argparse.Namespace) -> None:
9797
cls.builtIns = cls.builtIns.union(options.builtins)
9898
cls.with_doctest = options.doctests
9999

100-
def run(self) -> Generator[tuple[int, int, str, type[Any]], None, None]:
100+
def run(self) -> Generator[tuple[int, int, str, type[Any]]]:
101101
"""Run the plugin."""
102102
for message in self.messages:
103103
col = getattr(message, "col", 0)

0 commit comments

Comments
 (0)