add custom asyncio.wait_for()

This patch uses `wait_for2` package to implement `asyncio.wait_for()` for
Python < 3.12.

In Python 3.12, `asyncio.wait_for()` is implemented in terms of
`asyncio.timeout()` which fixed a bunch of issues. However, this was never
backported (because of the lack of `async.timeout()`) and there are still many
remainig issues, specially in Python 3.10, in `async.wait_for()`.

See https://github.com/python/cpython/pull/98518
This commit is contained in:
Aleix Conchillo Flaqué
2025-08-20 10:58:09 -07:00
parent 5286591826
commit f387776985
31 changed files with 119 additions and 53 deletions

11
uv.lock generated
View File

@@ -4195,6 +4195,7 @@ dependencies = [
{ name = "pyloudnorm" },
{ name = "resampy" },
{ name = "soxr" },
{ name = "wait-for2", marker = "python_full_version < '3.12'" },
]
[package.optional-dependencies]
@@ -4466,6 +4467,7 @@ requires-dist = [
{ name = "transformers", marker = "extra == 'ultravox'", specifier = ">=4.48.0" },
{ name = "uvicorn", marker = "extra == 'runner'", specifier = ">=0.32.0,<1.0.0" },
{ name = "vllm", marker = "extra == 'ultravox'", specifier = ">=0.9.0" },
{ name = "wait-for2", marker = "python_full_version < '3.12'", specifier = ">=0.4.1" },
{ name = "websockets", marker = "extra == 'assemblyai'", specifier = ">=13.1,<15.0" },
{ name = "websockets", marker = "extra == 'asyncai'", specifier = ">=13.1,<15.0" },
{ name = "websockets", marker = "extra == 'aws'", specifier = ">=13.1,<15.0" },
@@ -7316,6 +7318,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/f4/72/c14ff1acac64294f45782769b9c8144a1c3e8d4f2228d4648197511b015a/vllm-0.9.2-cp38-abi3-manylinux1_x86_64.whl", hash = "sha256:f3c5da29a286f4933b480a5b4749fab226564f35c96928eeef547f88d385cd34", size = 383350132, upload-time = "2025-07-08T04:48:54.133Z" },
]
[[package]]
name = "wait-for2"
version = "0.4.1"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/8f/7c/ea09d6a11990a8aa3ceac206fb7ea82366ea2c200caa87966611e0e18597/wait_for2-0.4.1.tar.gz", hash = "sha256:7f415415d21845c441391d6b4abe68f5959d2c0fbe927c2f61be28a297bc2acb", size = 17519, upload-time = "2025-06-13T19:45:00.081Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/90/56/0f88040567af7ff376ec9eaabe18fd980a4f5089d3bf8c7a32598ef06b8d/wait_for2-0.4.1-py3-none-any.whl", hash = "sha256:c694503e8c7420929e8a86bcffd9b00d55acaec2c14223a2b1e92bdc2ebf2154", size = 10985, upload-time = "2025-06-13T19:44:58.82Z" },
]
[[package]]
name = "watchfiles"
version = "1.1.0"