From 7dee759c54633513eaf9d29dc01b8e8759f7aceb Mon Sep 17 00:00:00 2001 From: PaulJonasJost Date: Tue, 24 Mar 2026 16:56:09 +0100 Subject: [PATCH 1/2] Removed T201 from lint.ignore --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5577c99..78b3d9f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,7 +89,6 @@ lint.ignore = [ "F401", # FIXME: those are ignored for now, should be fixed eventually "ERA001", # Found commented-out code - "T201", # `print` found" "SIM105", # Use `contextlib.suppress` "S110", # `try`-`except`-`pass` detected, consider logging the exception ] From c6e87d776a315699ef9f56783c189378d6141e47 Mon Sep 17 00:00:00 2001 From: PaulJonasJost Date: Tue, 24 Mar 2026 17:09:32 +0100 Subject: [PATCH 2/2] Replaced print statement with logger.exception. Long term, might be nice to include it in the applications logger --- src/petab_gui/views/simple_plot_view.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/petab_gui/views/simple_plot_view.py b/src/petab_gui/views/simple_plot_view.py index 0255600..369c7de 100644 --- a/src/petab_gui/views/simple_plot_view.py +++ b/src/petab_gui/views/simple_plot_view.py @@ -1,3 +1,4 @@ +import logging from collections import defaultdict import petab.v1.C as PETAB_C @@ -19,6 +20,8 @@ from .utils import proxy_to_dataframe +logger = logging.getLogger(__name__) + class PlotWorkerSignals(QObject): finished = Signal(object) # Emits final Figure @@ -196,8 +199,8 @@ def _render_on_main_thread(self, payload): fig = plt.gcf() self._update_tabs(fig) return - except Exception as e: - print(f"Invalid Visualisation DF: {e}") + except Exception: + logger.exception("Invalid Visualisation DF") # fallback to observable grouping plt.close("all") petab_vis.plot_without_vis_spec( @@ -412,8 +415,8 @@ def plot_residuals(self): axes=axes, ) create_plot_tab(fig_res, self, "Residuals vs Simulation") - except ValueError as e: - print(f"Error plotting residuals: {e}") + except ValueError: + logger.exception("Error plotting residuals") fig_fit, axes_fit = plt.subplots(constrained_layout=False) fig_fit.subplots_adjust(left=0.05, right=0.98, bottom=0.05, top=0.98) plot_goodness_of_fit(