File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919
2020logger = logging .getLogger (__name__ )
2121
22+ _TASK_REF_TZDATA : object = None # We need a global ref
23+
2224
2325def patch_sdk_for_pyodide () -> None :
2426 # -------------------
@@ -65,10 +67,12 @@ def patch_sdk_for_pyodide() -> None:
6567 # internally for e.g. datapoints and workflows.
6668 # Note: This convenience will only work in chromium-based browsers (as of Sept 2025)
6769 try :
70+ import asyncio
71+
6872 import micropip # type: ignore [import-not-found]
69- from pyodide .ffi import run_sync # type: ignore [import-not-found]
7073
71- run_sync (micropip .install ("tzdata" ))
74+ global _TASK_REF_TZDATA # keep the gc at bay
75+ _TASK_REF_TZDATA = asyncio .create_task (micropip .install ("tzdata" ))
7276 except Exception :
7377 logger .debug (
7478 "Could not load 'tzdata' package automatically in pyodide. You may need to do this manually:"
You can’t perform that action at this time.
0 commit comments