Skip to content

Commit b41572e

Browse files
authored
Merge pull request #427 from bluetech/drop-py37
Remove support for Python 3.7
2 parents c8b59d6 + 9a21725 commit b41572e

File tree

12 files changed

+49
-69
lines changed

12 files changed

+49
-69
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
name: [
22-
"windows-py37",
22+
"windows-py38",
2323
"windows-py311",
2424
"windows-pypy3",
2525

2626
"ubuntu-py38-pytestmain",
27-
"ubuntu-py37",
2827
"ubuntu-py38",
2928
"ubuntu-py39",
3029
"ubuntu-py310",
@@ -35,10 +34,10 @@ jobs:
3534
]
3635

3736
include:
38-
- name: "windows-py37"
39-
python: "3.7"
37+
- name: "windows-py38"
38+
python: "3.8"
4039
os: windows-latest
41-
tox_env: "py37"
40+
tox_env: "py38"
4241
- name: "windows-py311"
4342
python: "3.10"
4443
os: windows-latest
@@ -47,11 +46,6 @@ jobs:
4746
python: "pypy3.9"
4847
os: windows-latest
4948
tox_env: "pypy3"
50-
- name: "ubuntu-py37"
51-
python: "3.7"
52-
os: ubuntu-latest
53-
tox_env: "py37"
54-
use_coverage: true
5549
- name: "ubuntu-py38"
5650
python: "3.8"
5751
os: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repos:
1111
rev: v3.10.0
1212
hooks:
1313
- id: reorder-python-imports
14-
args: ['--application-directories=.:src', --py37-plus]
14+
args: ['--application-directories=.:src', --py38-plus]
1515
- repo: https://github.com/pre-commit/pre-commit-hooks
1616
rev: v2.1.0
1717
hooks:
@@ -27,7 +27,7 @@ repos:
2727
rev: v3.10.1
2828
hooks:
2929
- id: pyupgrade
30-
args: [--py37-plus]
30+
args: [--py38-plus]
3131
- repo: https://github.com/psf/black
3232
rev: 23.7.0
3333
hooks:

.readthedocs.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
3+
python:
4+
install:
5+
# Without this, sphinx can't find pluggy's version.
6+
- method: pip
7+
path: .
8+
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"

changelog/426.removal.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Python 3.7 is no longer supported.

docs/conf.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
import sys
1+
from importlib import metadata
22
from typing import TYPE_CHECKING
33

44
if TYPE_CHECKING:
55
import sphinx.application
66

7-
if sys.version_info >= (3, 8):
8-
from importlib import metadata
9-
else:
10-
import importlib_metadata as metadata
11-
127

138
extensions = [
149
"sphinx.ext.autodoc",

setup.cfg

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ classifiers =
2222
Programming Language :: Python :: Implementation :: PyPy
2323
Programming Language :: Python :: 3
2424
Programming Language :: Python :: 3 :: Only
25-
Programming Language :: Python :: 3.7
2625
Programming Language :: Python :: 3.8
2726
Programming Language :: Python :: 3.9
2827
Programming Language :: Python :: 3.10
@@ -31,9 +30,7 @@ classifiers =
3130
[options]
3231
packages =
3332
pluggy
34-
install_requires =
35-
importlib-metadata>=0.12;python_version<"3.8"
36-
python_requires = >=3.7
33+
python_requires = >=3.8
3734
package_dir =
3835
=src
3936
setup_requires =

src/pluggy/_callers.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
from typing import Mapping
99
from typing import Sequence
1010
from typing import Tuple
11-
from typing import TYPE_CHECKING
1211
from typing import Union
1312

13+
from ._hooks import HookImpl
1414
from ._result import _raise_wrapfail
1515
from ._result import _Result
1616
from ._result import HookCallError
1717

18-
if TYPE_CHECKING:
19-
from ._hooks import HookImpl
20-
2118

2219
# Need to distinguish between old- and new-style hook wrappers.
2320
# Wrapping one a singleton tuple is the fastest type-safe way I found to do it.

src/pluggy/_hooks.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from typing import AbstractSet
1111
from typing import Any
1212
from typing import Callable
13+
from typing import Final
1314
from typing import Generator
1415
from typing import List
1516
from typing import Mapping
@@ -18,15 +19,12 @@
1819
from typing import Sequence
1920
from typing import Tuple
2021
from typing import TYPE_CHECKING
22+
from typing import TypedDict
2123
from typing import TypeVar
2224
from typing import Union
2325

2426
from ._result import _Result
2527

26-
if TYPE_CHECKING:
27-
from typing_extensions import TypedDict
28-
from typing_extensions import Final
29-
3028

3129
_T = TypeVar("_T")
3230
_F = TypeVar("_F", bound=Callable[..., object])
@@ -37,20 +35,21 @@
3735
Union[object, List[object]],
3836
]
3937
_HookImplFunction = Callable[..., Union[_T, Generator[None, _Result[_T], None]]]
40-
if TYPE_CHECKING:
41-
42-
class _HookSpecOpts(TypedDict):
43-
firstresult: bool
44-
historic: bool
45-
warn_on_impl: Warning | None
46-
47-
class _HookImplOpts(TypedDict):
48-
wrapper: bool
49-
hookwrapper: bool
50-
optionalhook: bool
51-
tryfirst: bool
52-
trylast: bool
53-
specname: str | None
38+
39+
40+
class _HookSpecOpts(TypedDict):
41+
firstresult: bool
42+
historic: bool
43+
warn_on_impl: Warning | None
44+
45+
46+
class _HookImplOpts(TypedDict):
47+
wrapper: bool
48+
hookwrapper: bool
49+
optionalhook: bool
50+
tryfirst: bool
51+
trylast: bool
52+
specname: str | None
5453

5554

5655
class HookspecMarker:

src/pluggy/_manager.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
from __future__ import annotations
22

3+
import importlib.metadata
34
import inspect
4-
import sys
55
import types
66
import warnings
77
from typing import Any
88
from typing import Callable
99
from typing import cast
10+
from typing import Final
1011
from typing import Iterable
1112
from typing import Mapping
1213
from typing import Sequence
13-
from typing import TYPE_CHECKING
1414

1515
from . import _tracing
1616
from ._callers import _multicall
1717
from ._hooks import _HookCaller
1818
from ._hooks import _HookImplFunction
19+
from ._hooks import _HookImplOpts
1920
from ._hooks import _HookRelay
21+
from ._hooks import _HookSpecOpts
2022
from ._hooks import _Namespace
2123
from ._hooks import _Plugin
2224
from ._hooks import _SubsetHookCaller
@@ -25,15 +27,6 @@
2527
from ._hooks import normalize_hookimpl_opts
2628
from ._result import _Result
2729

28-
if sys.version_info >= (3, 8):
29-
from importlib import metadata as importlib_metadata
30-
else:
31-
import importlib_metadata
32-
33-
if TYPE_CHECKING:
34-
from typing_extensions import Final
35-
36-
from ._hooks import _HookImplOpts, _HookSpecOpts
3730

3831
_BeforeTrace = Callable[[str, Sequence[HookImpl], Mapping[str, Any]], None]
3932
_AfterTrace = Callable[[_Result[Any], str, Sequence[HookImpl], Mapping[str, Any]], None]
@@ -63,7 +56,7 @@ def __init__(self, plugin: _Plugin, message: str) -> None:
6356
class DistFacade:
6457
"""Emulate a pkg_resources Distribution"""
6558

66-
def __init__(self, dist: importlib_metadata.Distribution) -> None:
59+
def __init__(self, dist: importlib.metadata.Distribution) -> None:
6760
self._dist = dist
6861

6962
@property
@@ -351,7 +344,7 @@ def load_setuptools_entrypoints(self, group: str, name: str | None = None) -> in
351344
:return: The number of plugins loaded by this call.
352345
"""
353346
count = 0
354-
for dist in list(importlib_metadata.distributions()):
347+
for dist in list(importlib.metadata.distributions()):
355348
for ep in dist.entry_points:
356349
if (
357350
ep.group != group

src/pluggy/_result.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@
88
from typing import cast
99
from typing import Generator
1010
from typing import Generic
11+
from typing import NoReturn
1112
from typing import Optional
1213
from typing import Tuple
1314
from typing import Type
14-
from typing import TYPE_CHECKING
1515
from typing import TypeVar
1616

17-
if TYPE_CHECKING:
18-
from typing import NoReturn
19-
2017

2118
_ExcInfo = Tuple[Type[BaseException], BaseException, Optional[TracebackType]]
2219
_T = TypeVar("_T")

0 commit comments

Comments
 (0)