diff --git a/mobile/MODULE.bazel b/mobile/MODULE.bazel index a1cbd57f26808..410ba70a4422f 100644 --- a/mobile/MODULE.bazel +++ b/mobile/MODULE.bazel @@ -24,7 +24,6 @@ local_path_override( ) pip.parse( - experimental_index_url = "https://us-python.pkg.dev/artifact-foundry-prod/python-3p-trusted/simple/", hub_name = "pypi", python_version = PYTHON_VERSION, requirements_lock = "//:requirements.txt", diff --git a/mobile/library/python/envoy_mobile/async_client/client.py b/mobile/library/python/envoy_mobile/async_client/client.py index c5dfc347a9566..e3f836d1ef551 100644 --- a/mobile/library/python/envoy_mobile/async_client/client.py +++ b/mobile/library/python/envoy_mobile/async_client/client.py @@ -1,10 +1,9 @@ """High level asyncio client built on top of the Envoy Mobile bindings.""" import asyncio -from typing import Any, Dict, List, Optional, Union +from typing import Any, Callable, Dict, List, Optional, Protocol, Union from .. import envoy_engine -from ..envoy_engine import EngineBuilder from .executor import AsyncioExecutor, Executor from .response import ClientResponseError, Response @@ -13,6 +12,11 @@ ) +class EngineBuilderLike(Protocol): + def set_on_engine_running(self, closure: Callable[[], None]) -> "EngineBuilderLike": ... + def build(self) -> Any: ... + + class AsyncClient: """A very small HTTP client that speaks the subset of envoy_requests that we care about. @@ -25,11 +29,11 @@ class AsyncClient: Use as an async context manager: ``async with AsyncClient(engine_builder) as client:`` """ - def __init__(self, engine_builder: EngineBuilder) -> None: + def __init__(self, engine_builder: EngineBuilderLike) -> None: """Construct a new AsyncClient. Args: - engine_builder: A pre-configured EngineBuilder to finalize and build. + engine_builder: A pre-configured EngineBuilder (or compatible builder object) to finalize and build. """ self._engine_builder = engine_builder self._engine = None