diff --git a/CHANGELOG.md b/CHANGELOG.md index a92aabe..43562aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,10 @@ # Changelog *`shed` uses [calendar versioning](https://calver.org/), with a year.month.patch scheme.* +#### 2024.10.1 - 2024-04-27 - Disable `PIE790` fix due to [ruff issue #10538](https://github.com/astral-sh/ruff/issues/10538) +- [Python 3.8 has reached end-of-life](https://devguide.python.org/versions/), + so `shed` targets and runs on Python 3.9 or later. #### 2024.3.1 - 2024-03-13 - Replace usage of Autoflake, PyUpgrade and isort with ruff. diff --git a/README.md b/README.md index 07bf58a..d208b95 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ adding the following to your `.pre-commit-config.yaml`: minimum_pre_commit_version: '2.9.0' repos: - repo: https://github.com/Zac-HD/shed - rev: 2024.3.1 + rev: 2024.10.1 hooks: - id: shed # args: [--refactor, --py311-plus] diff --git a/setup.py b/setup.py index eb7869d..aa206cc 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ "pyupgrade >= 3.15.0", "ruff", ], - python_requires=">=3.8", + python_requires=">=3.9", classifiers=[ "Development Status :: 4 - Beta", "License :: OSI Approved :: GNU Affero General Public License v3", diff --git a/src/shed/__init__.py b/src/shed/__init__.py index aee2e57..69d83cd 100644 --- a/src/shed/__init__.py +++ b/src/shed/__init__.py @@ -12,13 +12,14 @@ import textwrap import warnings from operator import attrgetter -from typing import Any, FrozenSet, Match, Tuple +from re import Match +from typing import Any, FrozenSet, Tuple import black from black.mode import TargetVersion from black.parsing import lib2to3_parse -__version__ = "2024.4.1" +__version__ = "2024.10.1" __all__ = ["shed", "docshed"] # Conditionally imported in refactor mode to reduce startup latency in the common case @@ -28,7 +29,7 @@ _version_map = { k: (int(k.name[2]), int(k.name[3:])) for k in TargetVersion - if k.value >= TargetVersion.PY38.value + if k.value >= TargetVersion.PY39.value } _default_min_version = min(_version_map.values()) _SUGGESTIONS = ( diff --git a/src/shed/_cli.py b/src/shed/_cli.py index 1158ec5..cf3f042 100644 --- a/src/shed/_cli.py +++ b/src/shed/_cli.py @@ -59,7 +59,7 @@ def _guess_first_party_modules(cwd: Optional[str] = None) -> FrozenSet[str]: ) -@functools.lru_cache(maxsize=None) +@functools.cache def _should_format(fname: str) -> bool: return fname.endswith((".md", ".rst", ".pyi")) or is_python_file(fname) diff --git a/src/shed/_codemods.py b/src/shed/_codemods.py index c25a535..19c6952 100644 --- a/src/shed/_codemods.py +++ b/src/shed/_codemods.py @@ -570,9 +570,6 @@ def _remove_recursive_helper(cls, bool_node): @leave(m.With()) def remove_nested_with(self, _, updated_node): - if self.min_version < (3, 9): - return updated_node - candidate_with: cst.With = updated_node compound_items: List[cst.WithItem] = [] final_body: cst.BaseSuite = candidate_with.body diff --git a/tests/test_shed.py b/tests/test_shed.py index 91d645f..5b98de8 100644 --- a/tests/test_shed.py +++ b/tests/test_shed.py @@ -89,7 +89,7 @@ def check( return result -example_kwargs = {"refactor": True, "provides": frozenset(), "min_version": (3, 8)} +example_kwargs = {"refactor": True, "provides": frozenset(), "min_version": (3, 9)} @given( diff --git a/tox.ini b/tox.ini index 9b43060..d8737c1 100644 --- a/tox.ini +++ b/tox.ini @@ -30,7 +30,7 @@ commands = [testenv:deps] description = Updates test corpora and the pinned dependencies in `deps/*.txt` -basepython = 3.8 +basepython = 3.9 deps = pip-tools commands = @@ -53,7 +53,7 @@ ignore = D1,E501,W503,S101,S310,SIM105 exclude = .*/,__pycache__ [mypy] -python_version = 3.8 +python_version = 3.9 platform = linux disallow_untyped_calls = True disallow_untyped_defs = True