diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a00563..dd06ddc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Changed + +- Python 3.9+ is required [#152](https://github.com/python-backoff/backoff/pull/152) + ### Documentation - Fixed some examples [#116](https://github.com/python-backoff/backoff/pull/116) (from [@edgarrmondragon](https://github.com/edgarrmondragon)) diff --git a/backoff/_decorator.py b/backoff/_decorator.py index 3be55f6..d8b4c75 100644 --- a/backoff/_decorator.py +++ b/backoff/_decorator.py @@ -3,7 +3,7 @@ import inspect import logging import operator -from typing import TYPE_CHECKING, Any, Callable, Iterable +from typing import TYPE_CHECKING, Any, Callable from backoff import _async, _sync from backoff._common import ( @@ -15,6 +15,8 @@ from backoff._jitter import full_jitter if TYPE_CHECKING: + from collections.abc import Iterable + from backoff._typing import ( _CallableT, _Handler, diff --git a/backoff/_typing.py b/backoff/_typing.py index c2b42ad..5485604 100644 --- a/backoff/_typing.py +++ b/backoff/_typing.py @@ -1,13 +1,11 @@ from __future__ import annotations import logging +from collections.abc import Coroutine, Generator, Sequence from typing import ( TYPE_CHECKING, Any, Callable, - Coroutine, - Generator, - Sequence, TypedDict, TypeVar, Union, diff --git a/backoff/_wait_gen.py b/backoff/_wait_gen.py index f015989..ec904dd 100644 --- a/backoff/_wait_gen.py +++ b/backoff/_wait_gen.py @@ -2,7 +2,10 @@ import itertools import math -from typing import Any, Callable, Generator, Iterable +from typing import TYPE_CHECKING, Any, Callable + +if TYPE_CHECKING: + from collections.abc import Generator, Iterable def expo( diff --git a/pyproject.toml b/pyproject.toml index d16ae86..1f3b2e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "2.3.1" description = "Function decoration for backoff and retry" authors = [{ name = "Bob Green", email = "rgreen@aquent.com" }] maintainers = [{ name = "Edgar Ramírez-Mondragón", email = "edgarrm358@gmail.com" }] -requires-python = ">=3.8" +requires-python = ">=3.9" readme = "README.rst" license = "MIT" keywords = [ @@ -19,7 +19,6 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -73,12 +72,11 @@ include = ["backoff", "tests"] include = ["backoff"] [tool.tox] -min_version = "4.43" -requires = [ "tox>=4.43", "tox-uv" ] +requires = [ "tox>=4.53", "tox-uv" ] env_list = [ "format", { product = [ - { prefix = "3.", start = 8 }, + { prefix = "3.", start = 9 }, ] }, "coverage", "lint", @@ -87,7 +85,7 @@ env_list = [ ] [tool.tox.env_run_base] -description = "run unit tests" +description = "run unit tests on Python {py_dot_ver}" dependency_groups = [ "test" ] uv_python_preference = "managed" commands = [ diff --git a/tests/test_backoff.py b/tests/test_backoff.py index 2aac96a..6a56a61 100644 --- a/tests/test_backoff.py +++ b/tests/test_backoff.py @@ -928,9 +928,12 @@ def test_event_log_levels( max_tries = 3 func = func_factory(backoff_log_level, giveup_log_level, max_tries) - with unittest.mock.patch("time.sleep", return_value=None), caplog.at_level( - min(backoff_log_level, giveup_log_level), - logger="backoff", + with ( + unittest.mock.patch("time.sleep", return_value=None), + caplog.at_level( + min(backoff_log_level, giveup_log_level), + logger="backoff", + ), ): func()