From 6942dadf7bbdbb1815936f2dce04983c962000e2 Mon Sep 17 00:00:00 2001 From: Ian Schneider Date: Tue, 27 May 2025 11:59:40 -0600 Subject: [PATCH 1/2] deps - exclude click version that breaks tests (#1149) see https://github.com/pallets/click/issues/2939 for details test breakage example: https://github.com/planetlabs/planet-client-python/actions/runs/15197299407/job/42744343858?pr=1146 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bf915176..59ef0923 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "planet" authors = [{ name = "Planet", email = "python-sdk-contributors@planet.com" }] description = "Planet SDK for Python" dependencies = [ - "click>=8.0", + "click (>=8.0,!=8.2.1)", "geojson", "httpx>=0.28.0", "jsonschema", From 263fbf6d6117ec657f8e5ce17b74e64a90b5f884 Mon Sep 17 00:00:00 2001 From: Ian Schneider Date: Tue, 27 May 2025 16:26:02 -0600 Subject: [PATCH 2/2] session stops background loop on exit/close (#1146) session - lazily initialize event loop --- planet/http.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/planet/http.py b/planet/http.py index d43e2e38..e02bc604 100644 --- a/planet/http.py +++ b/planet/http.py @@ -282,6 +282,12 @@ async def alog_response(*args, **kwargs): self._limiter = _Limiter(rate_limit=RATE_LIMIT, max_workers=MAX_ACTIVE) self.outcomes: Counter[str] = Counter() + self._loop: asyncio.AbstractEventLoop = None # type: ignore + + def _init_loop(self): + if self._loop: + return + # create a dedicated event loop for this httpx session. def _start_background_loop(loop): asyncio.set_event_loop(loop) @@ -294,6 +300,7 @@ def _start_background_loop(loop): self._loop_thread.start() def _call_sync(self, f: Awaitable[T]) -> T: + self._init_loop() return asyncio.run_coroutine_threadsafe(f, self._loop).result() @classmethod