From a97de449c4bec0c5247efbb132e1dffd9e1d142c Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Mon, 22 Sep 2025 21:33:51 -0500 Subject: [PATCH 1/3] Clarify and polish UI text for Python interpreter prefs pane --- spyder/plugins/maininterpreter/confpage.py | 65 +++++++++++----------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/spyder/plugins/maininterpreter/confpage.py b/spyder/plugins/maininterpreter/confpage.py index b9ca19c3c30..b8c24c3076b 100644 --- a/spyder/plugins/maininterpreter/confpage.py +++ b/spyder/plugins/maininterpreter/confpage.py @@ -68,18 +68,18 @@ def setup_page(self): pyexec_bg = QButtonGroup(pyexec_group) pyexec_label = QLabel( _( - "Select the default Python interpreter to create new IPython " - "consoles and to provide code completion in the Editor" + "Select the default Python interpreter for new IPython consoles " + "and Editor code completion" ) ) pyexec_label.setWordWrap(True) self.def_exec_radio = self.create_radiobutton( - _("Internal (i.e. the same used by Spyder)"), + _("Internal (same used by Spyder)"), 'default', button_group=pyexec_bg, ) self.cus_exec_radio = self.create_radiobutton( - _("Use the following interpreter:"), + _("Selected interpreter:"), 'custom', button_group=pyexec_bg, ) @@ -117,40 +117,39 @@ def setup_page(self): # UMR Group umr_group = QGroupBox(_("User Module Reloader (UMR)")) - umr_label = QLabel(_("UMR forces Python to reload modules which were " - "imported when executing a file in a Python or " - "IPython console with the runfile " - "function.")) + umr_label = QLabel( + _( + "UMR forces Python to reload imported modules when " + "running a file in an IPython console." + ), + ) umr_label.setWordWrap(True) umr_enabled_box = newcb( _("Enable UMR"), 'umr/enabled', - msg_if_enabled=True, - msg_warning=_( + msg_info=_("This change will only be applied to new consoles"), + tip=_( "This option will enable the User Module Reloader (UMR) " - "in Python/IPython consoles. UMR forces Python to " - "reload deeply modules during import when running a " - "Python file using the Spyder's builtin function " - "runfile." - "

1. UMR may require to restart the " - "console in which it will be called " + "in Python/IPython consoles. UMR forces Python to perform a " + "deep reload of imported modules when running Python files " + "with Spyder's Run command.

" + "After being enabled, UMR requires a console restart " "(otherwise only newly imported modules will be " - "reloaded when executing files)." - "

2. If errors occur when re-running a " - "PyQt-based program, please check that the Qt objects " - "are properly destroyed (e.g. you may have to use the " - "attribute Qt.WA_DeleteOnClose on your main " - "window, using the setAttribute method)" + "reloaded when running files).

" + "If errors occur when re-running a PyQt-based program, " + "please check that the Qt objects are properly destroyed " + "(e.g. you may have to use the attribute " + "Qt.WA_DeleteOnClose on your main window, " + "using the setAttribute method)." ), ) umr_verbose_box = newcb( - _("Show reloaded modules list"), + _("Print list of reloaded modules"), 'umr/verbose', - msg_info=_("Please note that these changes will " - "be applied only to new consoles"), + msg_info=_("This change will only be applied to new consoles"), ) umr_namelist_btn = QPushButton( - _("Set UMR excluded (not reloaded) modules")) + _("Select modules to exclude from being reloaded")) umr_namelist_btn.clicked.connect(self.set_umr_namelist) umr_layout = QVBoxLayout() @@ -197,12 +196,12 @@ def warn_python_compatibility(self, pyexec): return True def set_umr_namelist(self): - """Set UMR excluded modules name list""" + """Set UMR excluded module names list.""" + example_excludes = "numpy, scipy" arguments, valid = QInputDialog.getText( self, _('UMR'), - _("Set the list of excluded modules as this: " - "numpy, scipy"), + _("List of excluded modules (e.g. {})").format(example_excludes), QLineEdit.Normal, ", ".join(self.get_option('umr/namelist')), ) @@ -222,15 +221,15 @@ def set_umr_namelist(self): QMessageBox.warning( self, _('UMR'), - _("The following modules are not " - "installed on your machine:\n%s") % invalid, + _( + "The following modules are not installed:\n{}" + ).format(invalid), QMessageBox.Ok, ) QMessageBox.information( self, _('UMR'), - _("Please note that these changes will " - "be applied only to new IPython consoles"), + _("Changes will only be applied to new IPython consoles"), QMessageBox.Ok, ) else: From aad2065e2a29a0cbb65eb714a5d059a4bbfd0a5b Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Mon, 22 Sep 2025 21:39:33 -0500 Subject: [PATCH 2/3] Remove obselete Python 2 interpreter compat warning --- spyder/plugins/maininterpreter/confpage.py | 34 ---------------------- 1 file changed, 34 deletions(-) diff --git a/spyder/plugins/maininterpreter/confpage.py b/spyder/plugins/maininterpreter/confpage.py index b8c24c3076b..8baf7652dc7 100644 --- a/spyder/plugins/maininterpreter/confpage.py +++ b/spyder/plugins/maininterpreter/confpage.py @@ -9,7 +9,6 @@ # Standard library imports import os import os.path as osp -import sys # Third party imports from qtpy.QtWidgets import (QButtonGroup, QGroupBox, QInputDialog, QLabel, @@ -165,36 +164,6 @@ def setup_page(self): vlayout.addStretch(1) self.setLayout(vlayout) - def warn_python_compatibility(self, pyexec): - if not osp.isfile(pyexec): - return - - spyder_version = sys.version_info[0] - try: - args = ["-c", "import sys; print(sys.version_info[0])"] - proc = programs.run_program(pyexec, args, env={}) - console_version = int(proc.communicate()[0]) - except IOError: - console_version = spyder_version - except ValueError: - return False - - if spyder_version != console_version: - QMessageBox.warning( - self, - _('Warning'), - _("You selected a Python %d interpreter for the " - "console but Spyder is running on Python %d!.

" - "Although this is possible, we recommend you to install and " - "run Spyder directly with your selected interpreter, to " - "avoid seeing false warnings and errors due to the " - "incompatible syntax between these two Python versions." - ) % (console_version, spyder_version), - QMessageBox.Ok, - ) - - return True - def set_umr_namelist(self): """Set UMR excluded module names list.""" example_excludes = "numpy, scipy" @@ -253,6 +222,3 @@ def perform_adjustments(self): self.cus_exec_combo.combobox.clear() self.cus_exec_combo.combobox.addItems(custom_list) self.pyexec_edit.setText(executable) - - # Show warning compatibility message. - self.warn_python_compatibility(executable) From 432f200526a101b3c09f655032d67029e389b40f Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Wed, 24 Sep 2025 13:41:37 -0500 Subject: [PATCH 3/3] Update outdated reference to Python consoles in Console prefs Co-authored-by: Carlos Cordoba --- spyder/plugins/maininterpreter/confpage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyder/plugins/maininterpreter/confpage.py b/spyder/plugins/maininterpreter/confpage.py index 8baf7652dc7..1a2a0496f5a 100644 --- a/spyder/plugins/maininterpreter/confpage.py +++ b/spyder/plugins/maininterpreter/confpage.py @@ -129,7 +129,7 @@ def setup_page(self): msg_info=_("This change will only be applied to new consoles"), tip=_( "This option will enable the User Module Reloader (UMR) " - "in Python/IPython consoles. UMR forces Python to perform a " + "in IPython consoles. UMR forces Python to perform a " "deep reload of imported modules when running Python files " "with Spyder's Run command.

" "After being enabled, UMR requires a console restart "