Skip to content

Commit aad7bc6

Browse files
Require Python 3.10+, modernize type annotations
- Bump requires-python to >=3.10 in pyproject.toml - Remove Python 3.9 from classifiers, CI matrix, tox envlist - Update PyPy version references (pypy3.9 → pypy3.10) - Modernize type hints: Union → |, Optional → | None - Move Callable imports to collections.abc - Update pyupgrade to --py310-plus 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 6a9d811 commit aad7bc6

File tree

12 files changed

+27
-62
lines changed

12 files changed

+27
-62
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
name: [
33-
"windows-py39",
33+
"windows-py310",
3434
"windows-py313",
3535
"windows-pypy3",
3636

3737
"ubuntu-py310-pytestmain",
38-
"ubuntu-py39",
3938
"ubuntu-py310",
4039
"ubuntu-py311",
4140
"ubuntu-py312",
@@ -45,32 +44,28 @@ jobs:
4544
]
4645

4746
include:
48-
- name: "windows-py39"
49-
python: "3.9"
47+
- name: "windows-py310"
48+
python: "3.10"
5049
os: windows-latest
51-
tox_env: "py39"
50+
tox_env: "py310"
5251
- name: "windows-py313"
5352
python: "3.13"
5453
os: windows-latest
5554
tox_env: "py313"
5655
- name: "windows-pypy3"
57-
python: "pypy3.9"
56+
python: "pypy3.10"
5857
os: windows-latest
5958
tox_env: "pypy3"
6059
- name: "ubuntu-py310-pytestmain"
6160
python: "3.10"
6261
os: ubuntu-latest
6362
tox_env: "py310-pytestmain"
6463
use_coverage: true
65-
- name: "ubuntu-py39"
66-
python: "3.9"
67-
os: ubuntu-latest
68-
tox_env: "py39"
69-
use_coverage: true
7064
- name: "ubuntu-py310"
7165
python: "3.10"
7266
os: ubuntu-latest
7367
tox_env: "py310"
68+
use_coverage: true
7469
- name: "ubuntu-py311"
7570
python: "3.11"
7671
os: ubuntu-latest
@@ -87,12 +82,12 @@ jobs:
8782
tox_env: "py313"
8883
use_coverage: true
8984
- name: "ubuntu-pypy3"
90-
python: "pypy3.9"
85+
python: "pypy3.10"
9186
os: ubuntu-latest
9287
tox_env: "pypy3"
9388
use_coverage: true
9489
- name: "ubuntu-benchmark"
95-
python: "3.9"
90+
python: "3.10"
9691
os: ubuntu-latest
9792
tox_env: "benchmark"
9893

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repos:
2828
rev: v3.21.0
2929
hooks:
3030
- id: pyupgrade
31-
args: [--py39-plus]
31+
args: [--py310-plus]
3232
- repo: https://github.com/asottile/blacken-docs
3333
rev: 1.20.0
3434
hooks:

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ classifiers = [
2424
"Programming Language :: Python :: Implementation :: PyPy",
2525
"Programming Language :: Python :: 3",
2626
"Programming Language :: Python :: 3 :: Only",
27-
"Programming Language :: Python :: 3.9",
2827
"Programming Language :: Python :: 3.10",
2928
"Programming Language :: Python :: 3.11",
3029
"Programming Language :: Python :: 3.12",
3130
"Programming Language :: Python :: 3.13",
3231
]
3332
description = "plugin and hook calling mechanisms for python"
3433
readme = {file = "README.rst", content-type = "text/x-rst"}
35-
requires-python = ">=3.9"
34+
requires-python = ">=3.10"
3635

3736
dynamic = ["version"]
3837
[dependency-groups]

src/pluggy/_hooks.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from __future__ import annotations
66

7+
from collections.abc import Callable
78
from collections.abc import Generator
89
from collections.abc import Mapping
910
from collections.abc import Sequence
@@ -12,29 +13,26 @@
1213
import sys
1314
from types import ModuleType
1415
from typing import Any
15-
from typing import Callable
1616
from typing import Final
1717
from typing import final
18-
from typing import Optional
1918
from typing import overload
2019
from typing import TYPE_CHECKING
2120
from typing import TypedDict
2221
from typing import TypeVar
23-
from typing import Union
2422
import warnings
2523

2624
from ._result import Result
2725

2826

2927
_T = TypeVar("_T")
3028
_F = TypeVar("_F", bound=Callable[..., object])
31-
_Namespace = Union[ModuleType, type]
29+
_Namespace = ModuleType | type
3230
_Plugin = object
3331
_HookExec = Callable[
3432
[str, Sequence["HookImpl"], Mapping[str, object], bool],
35-
Union[object, list[object]],
33+
object | list[object],
3634
]
37-
_HookImplFunction = Callable[..., Union[_T, Generator[None, Result[_T], None]]]
35+
_HookImplFunction = Callable[..., _T | Generator[None, Result[_T], None]]
3836

3937

4038
class HookspecOpts(TypedDict):
@@ -374,7 +372,7 @@ def __getattr__(self, name: str) -> HookCaller: ...
374372
_HookRelay = HookRelay
375373

376374

377-
_CallHistory = list[tuple[Mapping[str, object], Optional[Callable[[Any], None]]]]
375+
_CallHistory = list[tuple[Mapping[str, object], Callable[[Any], None] | None]]
378376

379377

380378
class HookCaller:

src/pluggy/_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from __future__ import annotations
22

3+
from collections.abc import Callable
34
from collections.abc import Iterable
45
from collections.abc import Mapping
56
from collections.abc import Sequence
67
import inspect
78
import types
89
from typing import Any
9-
from typing import Callable
1010
from typing import cast
1111
from typing import Final
1212
from typing import TYPE_CHECKING

src/pluggy/_result.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44

55
from __future__ import annotations
66

7+
from collections.abc import Callable
78
from types import TracebackType
8-
from typing import Callable
99
from typing import cast
1010
from typing import final
1111
from typing import Generic
12-
from typing import Optional
1312
from typing import TypeVar
1413

1514

16-
_ExcInfo = tuple[type[BaseException], BaseException, Optional[TracebackType]]
15+
_ExcInfo = tuple[type[BaseException], BaseException, TracebackType | None]
1716
ResultType = TypeVar("ResultType")
1817

1918

src/pluggy/_tracing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
from __future__ import annotations
66

7+
from collections.abc import Callable
78
from collections.abc import Sequence
89
from typing import Any
9-
from typing import Callable
1010

1111

1212
_Writer = Callable[[str], object]

testing/test_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
from collections.abc import Callable
12
from functools import wraps
23
from typing import Any
3-
from typing import Callable
44
from typing import cast
55
from typing import TypeVar
66

testing/test_hookcaller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
from collections.abc import Callable
12
from collections.abc import Generator
23
from collections.abc import Sequence
3-
from typing import Callable
44
from typing import TypeVar
55

66
import pytest

testing/test_multicall.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
from collections.abc import Callable
12
from collections.abc import Mapping
23
from collections.abc import Sequence
3-
from typing import Callable
4-
from typing import Union
54

65
import pytest
76

@@ -20,7 +19,7 @@ def MC(
2019
methods: Sequence[Callable[..., object]],
2120
kwargs: Mapping[str, object],
2221
firstresult: bool = False,
23-
) -> Union[object, list[object]]:
22+
) -> object | list[object]:
2423
caller = _multicall
2524
hookfuncs = []
2625
for method in methods:

0 commit comments

Comments
 (0)