File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[project ]
22name = " pywry"
3- version = " 2.0.0rc1 "
3+ version = " 2.0.0rc2 "
44description = " A lightweight and blazingly fast, cross-platform, WebView rendering engine and desktop UI toolkit for Python."
55authors = [{ name = " PyWry" , email = " pywry2@gmail.com" }]
66license = { text = " Apache 2.0" }
Original file line number Diff line number Diff line change 1010# enters the Tauri event loop and exits immediately so the developer's
1111# application code never runs a second time. It is a complete no-op in
1212# every other situation (normal Python, frozen parent process, etc.).
13- from ._freeze import freeze_support
13+ from ._freeze import freeze_support , setup_pytauri_runtime
1414
1515
1616freeze_support ()
17+ setup_pytauri_runtime ()
1718
1819# pylint: disable=wrong-import-position
1920# Inline notebook module - import functions directly
Original file line number Diff line number Diff line change @@ -102,6 +102,20 @@ def _setup_pytauri_standalone() -> None:
102102 sys ._pytauri_standalone = True # type: ignore[attr-defined]
103103
104104
105+ def setup_pytauri_runtime () -> None :
106+ """Configure pytauri extension loading for all runtime modes.
107+
108+ Pytauri discovers its native extension via the ``pytauri`` entry-point
109+ group. If both the standalone ``pytauri-wheel`` package and PyWry are
110+ installed, discovery can yield multiple ``ext_mod`` providers and abort.
111+
112+ To keep startup deterministic, pre-register the extension module through
113+ pytauri's standalone mechanism before any ``import pytauri`` happens.
114+ This is safe and idempotent in normal and frozen environments.
115+ """
116+ _setup_pytauri_standalone ()
117+
118+
105119def freeze_support () -> None :
106120 """Handle subprocess re-entry in frozen executables.
107121
@@ -123,7 +137,7 @@ def freeze_support() -> None:
123137 # Pre-register pytauri's native extension to bypass entry-point
124138 # discovery, which fails in frozen builds when .dist-info metadata
125139 # is not preserved. This must run BEFORE any ``import pytauri``.
126- _setup_pytauri_standalone ()
140+ setup_pytauri_runtime ()
127141
128142 if os .environ .get ("PYWRY_IS_SUBPROCESS" ) != "1" :
129143 return
Original file line number Diff line number Diff line change @@ -204,9 +204,9 @@ def test_idempotent(self) -> None:
204204 sys .modules .pop ("__pytauri_ext_mod__" , None )
205205
206206 def test_freeze_support_calls_setup_in_frozen_mode (self ) -> None :
207- """freeze_support() must call _setup_pytauri_standalone when frozen."""
207+ """freeze_support() must call setup_pytauri_runtime when frozen."""
208208 source = inspect .getsource (freeze_support )
209- assert "_setup_pytauri_standalone " in source
209+ assert "setup_pytauri_runtime " in source
210210
211211
212212# ── PyInstaller hook validation ───────────────────────────────────────
You can’t perform that action at this time.
0 commit comments