From b53a15479e32f08dfdae898555299a6a9b03e8cf Mon Sep 17 00:00:00 2001 From: Anfimov Dima Date: Sat, 6 Dec 2025 20:56:41 +0100 Subject: [PATCH 1/2] chore: add python 3.14 to test suit --- .github/workflows/test.yml | 2 +- pyproject.toml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b6ef99b0..e32ee36d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,7 +39,7 @@ jobs: pytest: strategy: matrix: - py_version: ["3.10", "3.11", "3.12", "3.13"] + py_version: ["3.10", "3.11", "3.12", "3.13", "3.14"] pydantic_ver: ["<2", ">=2.5,<3"] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: "${{ matrix.os }}" diff --git a/pyproject.toml b/pyproject.toml index 47bd43da..ad66a6b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Operating System :: OS Independent", "Intended Audience :: Developers", "Topic :: System :: Networking", @@ -189,6 +190,7 @@ line-length = 88 "S311", # Standard pseudo-random generators are not suitable for security/cryptographic purposes "D101", # Missing docstring in public class "D102", # Missing docstring in public method + "PLR2004", # Magic value ] "docs/examples/*" = [ "D103", # Missing docstring in public function From 5f772a49c0804d98056528aba0679337b265b73f Mon Sep 17 00:00:00 2001 From: Anfimov Dima Date: Sat, 6 Dec 2025 20:58:46 +0100 Subject: [PATCH 2/2] fix: warning about asyncio.iscoroutinefunction usage --- pyproject.toml | 1 - taskiq/receiver/receiver.py | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ad66a6b9..d37a148e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -190,7 +190,6 @@ line-length = 88 "S311", # Standard pseudo-random generators are not suitable for security/cryptographic purposes "D101", # Missing docstring in public class "D102", # Missing docstring in public method - "PLR2004", # Magic value ] "docs/examples/*" = [ "D103", # Missing docstring in public function diff --git a/taskiq/receiver/receiver.py b/taskiq/receiver/receiver.py index 39632f37..d72963ba 100644 --- a/taskiq/receiver/receiver.py +++ b/taskiq/receiver/receiver.py @@ -2,6 +2,7 @@ import contextvars import functools import inspect +import sys from collections.abc import Callable from concurrent.futures import Executor from logging import getLogger @@ -23,6 +24,7 @@ from taskiq.utils import maybe_awaitable logger = getLogger(__name__) +PY_VERSION = sys.version_info QUEUE_DONE = b"-1" @@ -224,6 +226,11 @@ async def run_task( # noqa: C901, PLR0912, PLR0915 # Start a timer. start_time = time() + check_coroutine_func = ( + asyncio.iscoroutinefunction + if PY_VERSION <= (3, 13) + else inspect.iscoroutinefunction + ) try: # We put kwargs resolving here, # to be able to catch any exception (for example ), @@ -234,7 +241,7 @@ async def run_task( # noqa: C901, PLR0912, PLR0915 kwargs.update(message.kwargs) is_coroutine = True # If the function is a coroutine, we await it. - if asyncio.iscoroutinefunction(target): + if check_coroutine_func(target): target_future = target(*message.args, **kwargs) else: is_coroutine = False