Skip to content

Commit

Permalink
Merge pull request #556 from nicoddemus/drop-py38
Browse files Browse the repository at this point in the history
Drop Python 3.8 support
  • Loading branch information
nicoddemus authored Dec 9, 2024
2 parents 3d2b886 + b05954e commit 431be57
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 62 deletions.
26 changes: 10 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ jobs:
fail-fast: false
matrix:
name: [
"windows-py38",
"windows-py39",
"windows-py313",
"windows-pypy3",

"ubuntu-py38-pytestmain",
"ubuntu-py38",
"ubuntu-py39-pytestmain",
"ubuntu-py39",
"ubuntu-py310",
"ubuntu-py311",
Expand All @@ -35,10 +34,10 @@ jobs:
]

include:
- name: "windows-py38"
python: "3.8"
- name: "windows-py39"
python: "3.9"
os: windows-latest
tox_env: "py38"
tox_env: "py39"
- name: "windows-py313"
python: "3.13"
os: windows-latest
Expand All @@ -47,15 +46,10 @@ jobs:
python: "pypy3.9"
os: windows-latest
tox_env: "pypy3"
- name: "ubuntu-py38"
python: "3.8"
os: ubuntu-latest
tox_env: "py38"
use_coverage: true
- name: "ubuntu-py38-pytestmain"
python: "3.8"
- name: "ubuntu-py39-pytestmain"
python: "3.9"
os: ubuntu-latest
tox_env: "py38-pytestmain"
tox_env: "py39-pytestmain"
use_coverage: true
- name: "ubuntu-py39"
python: "3.9"
Expand Down Expand Up @@ -87,7 +81,7 @@ jobs:
tox_env: "pypy3"
use_coverage: true
- name: "ubuntu-benchmark"
python: "3.8"
python: "3.9"
os: ubuntu-latest
tox_env: "benchmark"

Expand Down Expand Up @@ -136,7 +130,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.x"

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
rev: v3.19.0
hooks:
- id: pyupgrade
args: [--py38-plus]
args: [--py39-plus]
- repo: https://github.com/asottile/blacken-docs
rev: 1.19.1
hooks:
Expand Down
1 change: 1 addition & 0 deletions changelog/556.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Python 3.8 is no longer supported.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ classifiers = [
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -33,7 +32,7 @@ classifiers = [
]
description = "plugin and hook calling mechanisms for python"
readme = {file = "README.rst", content-type = "text/x-rst"}
requires-python = ">=3.8"
requires-python = ">=3.9"

dynamic = ["version"]
[project.optional-dependencies]
Expand Down
9 changes: 4 additions & 5 deletions src/pluggy/_callers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

from __future__ import annotations

from collections.abc import Generator
from collections.abc import Mapping
from collections.abc import Sequence
from typing import cast
from typing import Generator
from typing import Mapping
from typing import NoReturn
from typing import Sequence
from typing import Tuple
from typing import Union
import warnings

Expand All @@ -22,7 +21,7 @@
# Need to distinguish between old- and new-style hook wrappers.
# Wrapping with a tuple is the fastest type-safe way I found to do it.
Teardown = Union[
Tuple[Generator[None, Result[object], None], HookImpl],
tuple[Generator[None, Result[object], None], HookImpl],
Generator[None, object, object],
]

Expand Down
16 changes: 7 additions & 9 deletions src/pluggy/_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@

from __future__ import annotations

from collections.abc import Generator
from collections.abc import Mapping
from collections.abc import Sequence
from collections.abc import Set
import inspect
import sys
from types import ModuleType
from typing import AbstractSet
from typing import Any
from typing import Callable
from typing import Final
from typing import final
from typing import Generator
from typing import List
from typing import Mapping
from typing import Optional
from typing import overload
from typing import Sequence
from typing import Tuple
from typing import TYPE_CHECKING
from typing import TypedDict
from typing import TypeVar
Expand All @@ -34,7 +32,7 @@
_Plugin = object
_HookExec = Callable[
[str, Sequence["HookImpl"], Mapping[str, object], bool],
Union[object, List[object]],
Union[object, list[object]],
]
_HookImplFunction = Callable[..., Union[_T, Generator[None, Result[_T], None]]]

Expand Down Expand Up @@ -376,7 +374,7 @@ def __getattr__(self, name: str) -> HookCaller: ...
_HookRelay = HookRelay


_CallHistory = List[Tuple[Mapping[str, object], Optional[Callable[[Any], None]]]]
_CallHistory = list[tuple[Mapping[str, object], Optional[Callable[[Any], None]]]]


class HookCaller:
Expand Down Expand Up @@ -608,7 +606,7 @@ class _SubsetHookCaller(HookCaller):
"_remove_plugins",
)

def __init__(self, orig: HookCaller, remove_plugins: AbstractSet[_Plugin]) -> None:
def __init__(self, orig: HookCaller, remove_plugins: Set[_Plugin]) -> None:
self._orig = orig
self._remove_plugins = remove_plugins
self.name = orig.name # type: ignore[misc]
Expand Down
6 changes: 3 additions & 3 deletions src/pluggy/_manager.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from __future__ import annotations

from collections.abc import Iterable
from collections.abc import Mapping
from collections.abc import Sequence
import inspect
import types
from typing import Any
from typing import Callable
from typing import cast
from typing import Final
from typing import Iterable
from typing import Mapping
from typing import Sequence
from typing import TYPE_CHECKING
import warnings

Expand Down
4 changes: 1 addition & 3 deletions src/pluggy/_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
from typing import final
from typing import Generic
from typing import Optional
from typing import Tuple
from typing import Type
from typing import TypeVar


_ExcInfo = Tuple[Type[BaseException], BaseException, Optional[TracebackType]]
_ExcInfo = tuple[type[BaseException], BaseException, Optional[TracebackType]]
ResultType = TypeVar("ResultType")


Expand Down
5 changes: 2 additions & 3 deletions src/pluggy/_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@

from __future__ import annotations

from collections.abc import Sequence
from typing import Any
from typing import Callable
from typing import Sequence
from typing import Tuple


_Writer = Callable[[str], object]
_Processor = Callable[[Tuple[str, ...], Tuple[Any, ...]], object]
_Processor = Callable[[tuple[str, ...], tuple[Any, ...]], object]


class TagTracer:
Expand Down
7 changes: 3 additions & 4 deletions testing/test_hookcaller.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from collections.abc import Generator
from collections.abc import Sequence
from typing import Callable
from typing import Generator
from typing import List
from typing import Sequence
from typing import TypeVar

import pytest
Expand Down Expand Up @@ -63,7 +62,7 @@ def addmeth(hc: HookCaller) -> AddMeth:
return AddMeth(hc)


def funcs(hookmethods: Sequence[HookImpl]) -> List[Callable[..., object]]:
def funcs(hookmethods: Sequence[HookImpl]) -> list[Callable[..., object]]:
return [hookmethod.function for hookmethod in hookmethods]


Expand Down
2 changes: 1 addition & 1 deletion testing/test_invocations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Iterator
from collections.abc import Iterator

import pytest

Expand Down
12 changes: 5 additions & 7 deletions testing/test_multicall.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from collections.abc import Mapping
from collections.abc import Sequence
from typing import Callable
from typing import List
from typing import Mapping
from typing import Sequence
from typing import Type
from typing import Union

import pytest
Expand All @@ -22,7 +20,7 @@ def MC(
methods: Sequence[Callable[..., object]],
kwargs: Mapping[str, object],
firstresult: bool = False,
) -> Union[object, List[object]]:
) -> Union[object, list[object]]:
caller = _multicall
hookfuncs = []
for method in methods:
Expand Down Expand Up @@ -250,7 +248,7 @@ def m1():


@pytest.mark.parametrize("exc", [ValueError, SystemExit])
def test_hookwrapper_exception(exc: "Type[BaseException]") -> None:
def test_hookwrapper_exception(exc: type[BaseException]) -> None:
out = []

@hookimpl(hookwrapper=True)
Expand Down Expand Up @@ -320,7 +318,7 @@ def m4():


@pytest.mark.parametrize("exc", [ValueError, SystemExit])
def test_wrapper_exception(exc: "Type[BaseException]") -> None:
def test_wrapper_exception(exc: type[BaseException]) -> None:
out = []

@hookimpl(wrapper=True)
Expand Down
5 changes: 2 additions & 3 deletions testing/test_pluginmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import importlib.metadata
from typing import Any
from typing import List

import pytest

Expand Down Expand Up @@ -606,7 +605,7 @@ def my_distributions():


def test_add_tracefuncs(he_pm: PluginManager) -> None:
out: List[Any] = []
out: list[Any] = []

class api1:
@hookimpl
Expand Down Expand Up @@ -659,7 +658,7 @@ def he_method1(self):
raise ValueError()

he_pm.register(api1())
out: List[Any] = []
out: list[Any] = []
he_pm.trace.root.setwriter(out.append)
undo = he_pm.enable_tracing()
try:
Expand Down
4 changes: 1 addition & 3 deletions testing/test_tracer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import List

import pytest

from pluggy._tracing import TagTracer
Expand All @@ -13,7 +11,7 @@ def rootlogger() -> TagTracer:
def test_simple(rootlogger: TagTracer) -> None:
log = rootlogger.get("pytest")
log("hello")
out: List[str] = []
out: list[str] = []
rootlogger.setwriter(out.append)
log("world")
assert len(out) == 1
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist=docs,py{38,39,310,311,312,313,py3},py{38}-pytest{main}
envlist=docs,py{39,310,311,312,313,py3},py{39}-pytestmain

[testenv]
commands=
Expand Down Expand Up @@ -40,7 +40,7 @@ filterwarnings =

[flake8]
max-line-length=99
min-python-version = 3.8
min-python-version = 3.9

[testenv:release]
description = do a release, required posarg of the version number
Expand Down

0 comments on commit 431be57

Please sign in to comment.