Skip to content

Commit

Permalink
Drop Python 3.7 support (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz committed Jul 10, 2023
1 parent 2b66124 commit af41442
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 109 deletions.
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
strategy:
matrix:
python-version:
- 3.7
- 3.8
- 3.9
- '3.10'
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repos:
rev: v3.7.0
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py38-plus]
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
Expand All @@ -55,7 +55,7 @@ repos:
hooks:
- id: reorder-python-imports
args:
- --py37-plus
- --py38-plus
- --application-directories
- .:example:src
- --add-import
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Changelog
=========

* Drop Python 3.7 support.

3.13.0 (2023-06-15)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A `flake8 <https://flake8.readthedocs.io/en/latest/index.html>`_ plugin that hel
Requirements
============

Python 3.7 to 3.12 supported.
Python 3.8 to 3.12 supported.

Installation
============
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ requires = [
]

[tool.black]
target-version = ['py37']
target-version = ['py38']

[tool.pytest.ini_options]
addopts = """\
Expand Down
5 changes: 0 additions & 5 deletions requirements/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
"--generate-hashes",
"--allow-unsafe",
] + sys.argv[1:]
subprocess.run(
["python3.7", *common_args, "-o", "py37.txt"],
check=True,
capture_output=True,
)
subprocess.run(
["python3.8", *common_args, "-o", "py38.txt"],
check=True,
Expand Down
74 changes: 0 additions & 74 deletions requirements/py37.txt

This file was deleted.

4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ classifiers =
Natural Language :: English
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
Expand All @@ -34,8 +33,7 @@ project_urls =
packages = find:
install_requires =
flake8!=3.2.0,>=3.0
importlib-metadata;python_version < "3.8"
python_requires = >=3.7
python_requires = >=3.8
include_package_data = True
package_dir =
=src
Expand Down
7 changes: 1 addition & 6 deletions src/flake8_comprehensions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
from __future__ import annotations

import ast
import sys
from importlib.metadata import version
from typing import Any
from typing import Generator

if sys.version_info >= (3, 8):
from importlib.metadata import version
else:
from importlib_metadata import version


class ComprehensionChecker:
"""
Expand Down
17 changes: 2 additions & 15 deletions tests/test_flake8_comprehensions.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
from __future__ import annotations

import re
import sys
from importlib.metadata import version
from textwrap import dedent

import pytest

if sys.version_info >= (3, 8):
from importlib.metadata import version
else:
from importlib_metadata import version


@pytest.fixture
def flake8_path(flake8_path):
Expand Down Expand Up @@ -791,14 +786,6 @@ def test_C416_pass(code, flake8_path):
assert result.out_lines == []


# Column offset for list comprehensions was incorrect in Python < 3.8.
# See https://bugs.python.org/issue31241 for details.
if sys.version_info >= (3, 8):
list_comp_col_offset = 0
else:
list_comp_col_offset = 1


@pytest.mark.parametrize(
"code,failures",
[
Expand All @@ -819,7 +806,7 @@ def test_C416_pass(code, flake8_path):
(
"[x for x in range(5)]",
[
f"./example.py:1:{1 + list_comp_col_offset}: C416 Unnecessary "
"./example.py:1:1: C416 Unnecessary "
+ "list comprehension - rewrite using list()."
],
),
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
requires =
tox>=4.2
env_list =
py{312, 311, 310, 39, 38, 37}
py{312, 311, 310, 39, 38}

[testenv]
package = wheel
Expand Down

0 comments on commit af41442

Please sign in to comment.