From 8d3df3b359340e6fc8c6506e05afb8668db3da86 Mon Sep 17 00:00:00 2001 From: DiegoP-G Date: Thu, 2 Jul 2026 17:31:21 +0200 Subject: [PATCH 1/2] fix: make graph_viewer import optional (USE_QT=OFF support) --- src/pyhpp_plot/__init__.py | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/pyhpp_plot/__init__.py b/src/pyhpp_plot/__init__.py index 67b95f1..ded7e16 100644 --- a/src/pyhpp_plot/__init__.py +++ b/src/pyhpp_plot/__init__.py @@ -1,9 +1,3 @@ -from .graph_viewer import ( - MenuActionProxy, - show_graph, - show_graph_blocking, - show_interactive_graph, -) from .graph_viewer_thread import GraphViewerThread from .interactive_viewer import InteractiveGraphViewer from .websocket_bridge import GraphWebSocketBridge @@ -12,8 +6,26 @@ "GraphViewerThread", "GraphWebSocketBridge", "InteractiveGraphViewer", - "MenuActionProxy", - "show_graph", - "show_graph_blocking", - "show_interactive_graph", ] + +try: + # `graph_viewer` is a Boost.Python extension module built only when + # hpp-plot is compiled with -DUSE_QT=ON (see CMakeLists.txt). It is not + # required by the recommended pyhpp_plot workflow (GraphViewerThread / + # InteractiveGraphViewer / GraphWebSocketBridge), so its absence must not + # prevent `import pyhpp_plot` from succeeding when built with USE_QT=OFF. + from .graph_viewer import ( + MenuActionProxy, + show_graph, + show_graph_blocking, + show_interactive_graph, + ) + + __all__ += [ + "MenuActionProxy", + "show_graph", + "show_graph_blocking", + "show_interactive_graph", + ] +except ImportError: + pass \ No newline at end of file From dfe8197eb879cdf11c2af3cf4ce86037225984c5 Mon Sep 17 00:00:00 2001 From: DiegoP-G Date: Thu, 2 Jul 2026 17:32:17 +0200 Subject: [PATCH 2/2] fix: pre-commit --- src/pyhpp_plot/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyhpp_plot/__init__.py b/src/pyhpp_plot/__init__.py index ded7e16..0ae0f11 100644 --- a/src/pyhpp_plot/__init__.py +++ b/src/pyhpp_plot/__init__.py @@ -28,4 +28,4 @@ "show_interactive_graph", ] except ImportError: - pass \ No newline at end of file + pass