From 69ed8b1dac92e33d6a2d18c1b3a3cfad57020d90 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Wed, 5 Apr 2023 21:30:10 +0100 Subject: [PATCH] Drop support for Python 3.7 This enables the use of newer Python typing functionality without compatibility shims. --- .github/workflows/ci.yml | 2 +- docs/changelog.rst | 2 +- noxfile.py | 2 +- pyproject.toml | 2 +- src/pyproject_hooks/_impl.py | 28 +++++++++++++--------------- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 422b44a..1f2e48e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11"] os: [Ubuntu, macOS, Windows] steps: diff --git a/docs/changelog.rst b/docs/changelog.rst index 7c08eea..0fe02a3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,7 +4,7 @@ Changelog v1.1 ---- -No changes. +- Drop support for Python 3.7. v1.0 ---- diff --git a/noxfile.py b/noxfile.py index 66ff09f..7bde1e9 100644 --- a/noxfile.py +++ b/noxfile.py @@ -6,7 +6,7 @@ nox.options.reuse_existing_virtualenvs = True -@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "pypy3"]) +@nox.session(python=["3.8", "3.9", "3.10", "3.11", "pypy3"]) def test(session: nox.Session) -> None: session.install("-r", "dev-requirements.txt") session.install(".") diff --git a/pyproject.toml b/pyproject.toml index 8e58eb3..e88812b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ authors = [ {name = "Thomas Kluyver", email = "thomas@kluyver.me.uk"}, ] readme = "README.rst" -requires-python = ">=3.7" +requires-python = ">=3.8" dependencies = [] classifiers = [ "License :: OSI Approved :: MIT License", diff --git a/src/pyproject_hooks/_impl.py b/src/pyproject_hooks/_impl.py index 19a5e6e..ed173eb 100644 --- a/src/pyproject_hooks/_impl.py +++ b/src/pyproject_hooks/_impl.py @@ -6,24 +6,10 @@ from os.path import abspath from os.path import join as pjoin from subprocess import STDOUT, check_call, check_output -from typing import TYPE_CHECKING, Any, Dict, Iterator, List, Optional +from typing import Any, Dict, Iterator, List, Optional, Protocol from ._in_process import _in_proc_script_path -if TYPE_CHECKING: - from typing import Protocol - - class SubprocessRunner(Protocol): - """A protocol for the subprocess runner.""" - - def __call__( - self, - cmd: List[str], - cwd: Optional[str] = None, - extra_environ: Optional[Dict[str, str]] = None, - ) -> None: - ... - def write_json(obj: Dict[str, Any], path: str, **kwargs) -> None: with open(path, "w", encoding="utf-8") as f: @@ -71,6 +57,18 @@ def __init__(self, traceback: str) -> None: self.traceback = traceback +class SubprocessRunner(Protocol): + """A protocol for the subprocess runner.""" + + def __call__( + self, + cmd: List[str], + cwd: Optional[str] = None, + extra_environ: Optional[Dict[str, str]] = None, + ) -> None: + ... + + def default_subprocess_runner( cmd: List[str], cwd: Optional[str] = None,