Skip to content

Commit

Permalink
Merge pull request #1741 from PyCQA/drop-py37
Browse files Browse the repository at this point in the history
require python 3.8.1+
  • Loading branch information
asottile authored Nov 18, 2022
2 parents 16c371d + aa002ee commit b87034d
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 94 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ jobs:
include:
# linux
- os: ubuntu-latest
python: pypy-3.7
toxenv: py
- os: ubuntu-latest
python: 3.7
python: pypy-3.8

This comment was marked as spam.

toxenv: py
- os: ubuntu-latest
python: 3.8
Expand All @@ -25,21 +22,24 @@ jobs:
python: 3.9
toxenv: py
- os: ubuntu-latest
python: '3.10.0-alpha - 3.10.999'
python: '3.10'
toxenv: py

This comment was marked as spam.

Copy link
@Val9090
- os: ubuntu-latest
python: '3.11'
toxenv: py
# windows
- os: windows-latest
python: 3.7
python: 3.8
toxenv: py
# misc
- os: ubuntu-latest
python: 3.9
python: '3.10'
toxenv: docs
- os: ubuntu-latest
python: 3.9
python: '3.10'
toxenv: linters
- os: ubuntu-latest
python: 3.9
python: '3.10'
toxenv: dogfood
runs-on: ${{ matrix.os }}
steps:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ repos:
- id: reorder-python-imports
args: [
--application-directories, '.:src',
--py37-plus,
--py38-plus,
--add-import, 'from __future__ import annotations',
]
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.2
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py38-plus]
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
Expand Down
8 changes: 2 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ classifiers =
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Software Development :: Libraries :: Python Modules
Expand All @@ -41,8 +37,8 @@ install_requires =
mccabe>=0.7.0,<0.8.0
pycodestyle>=2.9.0,<2.10.0
pyflakes>=2.5.0,<2.6.0
importlib-metadata>=1.1.0,<4.3;python_version<"3.8"
python_requires = >=3.7
# 3.8.0's importlib.metadata is broken
python_requires = >=3.8.1

[options.packages.find]
where = src
Expand Down
18 changes: 0 additions & 18 deletions src/flake8/_compat.py

This file was deleted.

14 changes: 7 additions & 7 deletions src/flake8/plugins/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import annotations

import configparser
import importlib.metadata
import inspect
import itertools
import logging
Expand All @@ -12,7 +13,6 @@
from typing import NamedTuple

from flake8 import utils
from flake8._compat import importlib_metadata
from flake8.defaults import VALID_CODE_PREFIX
from flake8.exceptions import ExecutionError
from flake8.exceptions import FailedToLoadPlugin
Expand All @@ -32,7 +32,7 @@ class Plugin(NamedTuple):

package: str
version: str
entry_point: importlib_metadata.EntryPoint
entry_point: importlib.metadata.EntryPoint


class LoadedPlugin(NamedTuple):
Expand Down Expand Up @@ -148,12 +148,12 @@ def parse_plugin_options(


def _flake8_plugins(
eps: Iterable[importlib_metadata.EntryPoint],
eps: Iterable[importlib.metadata.EntryPoint],
name: str,
version: str,
) -> Generator[Plugin, None, None]:
pyflakes_meta = importlib_metadata.distribution("pyflakes").metadata
pycodestyle_meta = importlib_metadata.distribution("pycodestyle").metadata
pyflakes_meta = importlib.metadata.distribution("pyflakes").metadata
pycodestyle_meta = importlib.metadata.distribution("pycodestyle").metadata

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

Expand Down Expand Up @@ -221,7 +221,7 @@ def _find_local_plugins(
):
name, _, entry_str = plugin_s.partition("=")
name, entry_str = name.strip(), entry_str.strip()
ep = importlib_metadata.EntryPoint(name, entry_str, group)
ep = importlib.metadata.EntryPoint(name, entry_str, group)
yield Plugin("local", "local", ep)


Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_checker.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""Integration tests for the checker submodule."""
from __future__ import annotations

import importlib.metadata
import sys
from unittest import mock

import pytest

from flake8 import checker
from flake8._compat import importlib_metadata
from flake8.plugins import finder
from flake8.processor import FileProcessor

Expand Down Expand Up @@ -85,7 +85,7 @@ def mock_file_checker_with_plugin(plugin_target):
finder.Plugin(
"flake-package",
"9001",
importlib_metadata.EntryPoint(
importlib.metadata.EntryPoint(
"Q",
f"{plugin_target.__module__}:{plugin_target.__name__}",
"flake8.extension",
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ def test_tokenization_error_but_not_syntax_error(tmpdir, capsys):

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

0 comments on commit b87034d

Please sign in to comment.