Skip to content

Commit efb4220

Browse files
committed
Build recipe for the standalone pyobs-gui binary
pysidedeploy.spec targets pyobs_gui/__main__.py (the interactive-login entry point) in --mode=standalone with clang pinned, matching the gui-widget-plugins-and-packaging.md packaging plan. Compiling the real app under Nuitka hit a genuine, unresolved upstream limitation: astropy's unit-string parser (astropy.units.format.generic) builds its PLY grammar via sys._getframe() stack-walking to auto-discover its own tokens/p_* locals, and Nuitka-compiled function frames don't populate f_locals the way CPython's do -- so the very first `import astropy.units` (pulled in unconditionally by pyobs-core's pyobs.utils.enums) crashed with "YaccError: Unable to build parser". See astropy/astropy#15069 and Nuitka/Nuitka#2313 -- both still open as of 2026-07. pyobs_gui/_nuitka_astropy_patch.py works around it by rebuilding the same grammar (copied verbatim from astropy's source) in a plain namespace object and feeding it to astropy.extern.ply.yacc/lex via their frame-introspection-free `module=` path, installed as a fallback in get_caller_module_dict itself (patching Generic._parser/_lexer directly deadlocks: importing astropy.units.core/format.generic to build the patch is what triggers the crash in the first place, before the patch could be installed). Wired in at the top of pyobs_gui/__init__.py, since that runs before anything else in the package. Scoped to the generic unit format only -- the one astropy hits unconditionally at startup. cds/ogip/vounit and astropy.coordinates.angles use the same PLY pattern and would need identical treatment if the compiled binary ever exercises them.
1 parent 4d20a29 commit efb4220

5 files changed

Lines changed: 563 additions & 4 deletions

File tree

‎.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ spike_standalone/deployment/
66
spike_standalone/*.dist/
77
spike_standalone/build*.log
88
spike_standalone/spike_results.txt
9+
10+
# pyside6-deploy build output for the real app -- generated, not source
11+
deployment/
12+
dist/
13+
build*.log

‎pyobs_gui/__init__.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
__title__ = "GUI"
66

7+
from ._nuitka_astropy_patch import patch_generic_unit_parser
8+
9+
patch_generic_unit_parser()
10+
711
from .gui import GUI
812
from .camerawidget import CameraWidget
913
from .datadisplaywidget import DataDisplayWidget

‎pyobs_gui/__main__.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
from __future__ import annotations
88

9-
from pyobs.application import Application
109

11-
from .gui import GUI
12-
from .login import login_and_build_gui
10+
def main() -> None:
11+
from pyobs.application import Application
1312

13+
from .gui import GUI
14+
from .login import login_and_build_gui
1415

15-
def main() -> None:
1616
app = Application(module_factory=login_and_build_gui, loop_module_class=GUI)
1717
app.run()
1818

0 commit comments

Comments
 (0)