diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a020b4a..20a76f0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,6 @@ jobs: strategy: matrix: python-version: - - 3.7 - 3.8 - 3.9 - '3.10' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1b25e89..9c45288 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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: @@ -55,7 +55,7 @@ repos: hooks: - id: reorder-python-imports args: - - --py37-plus + - --py38-plus - --application-directories - .:example:src - --add-import diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0cca4bf..4c275e3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,8 @@ Changelog ========= +* Drop Python 3.7 support. + 3.13.0 (2023-06-15) ------------------- diff --git a/README.rst b/README.rst index 7c11294..ba3c5a5 100644 --- a/README.rst +++ b/README.rst @@ -20,7 +20,7 @@ A `flake8 `_ plugin that hel Requirements ============ -Python 3.7 to 3.12 supported. +Python 3.8 to 3.12 supported. Installation ============ diff --git a/pyproject.toml b/pyproject.toml index f15f73a..74a500d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ requires = [ ] [tool.black] -target-version = ['py37'] +target-version = ['py38'] [tool.pytest.ini_options] addopts = """\ diff --git a/requirements/compile.py b/requirements/compile.py index 48eba10..0b3075d 100755 --- a/requirements/compile.py +++ b/requirements/compile.py @@ -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, diff --git a/requirements/py37.txt b/requirements/py37.txt deleted file mode 100644 index 6267204..0000000 --- a/requirements/py37.txt +++ /dev/null @@ -1,74 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.7 -# by the following command: -# -# requirements/compile.py -# -exceptiongroup==1.1.1 \ - --hash=sha256:232c37c63e4f682982c8b6459f33a8981039e5fb8756b2074364e5055c498c9e \ - --hash=sha256:d484c3090ba2889ae2928419117447a14daf3c1231d5e30d0aae34f354f01785 - # via pytest -flake8==5.0.4 \ - --hash=sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db \ - --hash=sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248 - # via pytest-flake8-path -importlib-metadata==4.2.0 ; python_version < "3.8" \ - --hash=sha256:057e92c15bc8d9e8109738a48db0ccb31b4d9d5cfbee5a8670879a30be66304b \ - --hash=sha256:b7e52a1f8dec14a75ea73e0891f3060099ca1d8e6a462a4dff11c3e119ea1b31 - # via - # -r requirements.in - # flake8 - # pluggy - # pytest - # pytest-randomly -iniconfig==2.0.0 \ - --hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \ - --hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374 - # via pytest -mccabe==0.7.0 \ - --hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \ - --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e - # via flake8 -packaging==23.1 \ - --hash=sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61 \ - --hash=sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f - # via pytest -pluggy==1.0.0 \ - --hash=sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159 \ - --hash=sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3 - # via pytest -pycodestyle==2.9.1 \ - --hash=sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785 \ - --hash=sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b - # via flake8 -pyflakes==2.5.0 \ - --hash=sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2 \ - --hash=sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3 - # via flake8 -pytest==7.3.2 \ - --hash=sha256:cdcbd012c9312258922f8cd3f1b62a6580fdced17db6014896053d47cddf9295 \ - --hash=sha256:ee990a3cc55ba808b80795a79944756f315c67c12b56abd3ac993a7b8c17030b - # via - # -r requirements.in - # pytest-flake8-path - # pytest-randomly -pytest-flake8-path==1.4.0 \ - --hash=sha256:b1c21f599158c90b68a16d301d1ffa19d25c297ef22f0ca4560160065a852e8b \ - --hash=sha256:c873d169e4ea5ab889413212bc33eb13d653c0e7f6c630fce6dc982076a228b7 - # via -r requirements.in -pytest-randomly==3.12.0 \ - --hash=sha256:d60c2db71ac319aee0fc6c4110a7597d611a8b94a5590918bfa8583f00caccb2 \ - --hash=sha256:f4f2e803daf5d1ba036cc22bf4fe9dbbf99389ec56b00e5cba732fb5c1d07fdd - # via -r requirements.in -tomli==2.0.1 \ - --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ - --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f - # via pytest -typing-extensions==4.6.3 \ - --hash=sha256:88a4153d8505aabbb4e13aacb7c486c2b4a33ca3b3f807914a9b4c844c471c26 \ - --hash=sha256:d91d5919357fe7f681a9f2b5b4cb2a5f1ef0a1e9f59c4d8ff0d3491e05c0ffd5 - # via importlib-metadata -zipp==3.15.0 \ - --hash=sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b \ - --hash=sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556 - # via importlib-metadata diff --git a/setup.cfg b/setup.cfg index 2fd1691..53c2c57 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 @@ -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 diff --git a/src/flake8_comprehensions/__init__.py b/src/flake8_comprehensions/__init__.py index b18a8ba..3a48a38 100644 --- a/src/flake8_comprehensions/__init__.py +++ b/src/flake8_comprehensions/__init__.py @@ -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: """ diff --git a/tests/test_flake8_comprehensions.py b/tests/test_flake8_comprehensions.py index 5537cb8..454cc31 100644 --- a/tests/test_flake8_comprehensions.py +++ b/tests/test_flake8_comprehensions.py @@ -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): @@ -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", [ @@ -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()." ], ), diff --git a/tox.ini b/tox.ini index d34f7c8..dd37ee3 100644 --- a/tox.ini +++ b/tox.ini @@ -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