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

require python 3.8.1+ #1741

Merged
merged 1 commit into from Nov 18, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/main.yml
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
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
- 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
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
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
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
@@ -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
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