Repository: spyder-ide/spyder

Issue:
Kernel running well on Python 3.9 for Spyder 4.2 but the title of app still showing 3.7?
## Problem Description
unsure if there will be any issues as the app doesn't look "pretty" with the wording on the top left as shown with 3.7 instead of the default. 
![image](https://user-images.githubusercontent.com/20274116/101288904-0d729500-3834-11eb-802e-d33414767900.png)

### What steps reproduce the problem?

1. installed kernels using pip install on my current path `C:\Users\<myusername>\AppData\Local\Programs\Python\Python39\python.exe`

2. Previously, GitBash, navigate with cd into the intended path directory as above, and typed `pip install spyder-kernels==1.10.00`
3. after installation have managed to see that the installer worked well with my Spyder IDE running on the interpreter meant for Python 3.9 but.... 

### What is the expected output? What do you see instead?

Can I ask with my interpreter set to the path as mentioned for the python version 3.9 is this the right way of doing so? please take note that I am not using Anaconda as I have moved away from it after several strange encounters with package managements. 



### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->
no traceback thus far
```python-traceback

PASTE TRACEBACK HERE

```

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 4.2.0 None
* Python version: 3.7.9 64-bit
* Qt version: 5.12.9
* PyQt5 version: 5.12.3
* Operating System: Windows 10

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```
PASTE DEPENDENCIES HERE
```
# Mandatory:
atomicwrites >=1.2.0            :  1.4.0 (OK)
chardet >=2.0.0                 :  3.0.4 (OK)
cloudpickle >=0.5.0             :  1.6.0 (OK)
diff_match_patch >=20181111     :  20200713 (OK)
intervaltree                    :  None (OK)
IPython >=4.0                   :  7.19.0 (OK)
jedi =0.17.2                    :  0.17.2 (OK)
jsonschema >=3.2.0              :  3.2.0 (OK)
nbconvert >=4.0                 :  6.0.7 (OK)
numpydoc >=0.6.0                :  1.1.0 (OK)
paramiko >=2.4.0                :  2.7.2 (OK)
parso =0.7.0                    :  0.7.0 (OK)
pexpect >=4.4.0                 :  4.8.0 (OK)
pickleshare >=0.4               :  0.7.5 (OK)
psutil >=5.3                    :  5.7.3 (OK)
pygments >=2.0                  :  2.7.2 (OK)
pylint >=1.0                    :  2.6.0 (OK)
pyls >=0.36.1;<1.0.0            :  0.36.1 (OK)
pyls_black >=0.4.6              :  0.4.6 (OK)
pyls_spyder >=0.1.1             :  0.1.1 (OK)
qdarkstyle >=2.8                :  2.8.1 (OK)
qtawesome >=0.5.7               :  1.0.1 (OK)
qtconsole >=4.7.7               :  4.7.7 (OK)
qtpy >=1.5.0                    :  1.9.0 (OK)
setuptools >=39.0.0             :  50.3.2 (OK)
sphinx >=0.6.6                  :  3.3.0 (OK)
spyder_kernels >=1.10.0;<1.11.0 :  1.10.0 (OK)
three_merge >=0.1.1             :  0.1.1 (OK)
watchdog                        :  None (OK)
zmq >=17                        :  19.0.2 (OK)

# Optional:
cython >=0.21                   :  0.29.21 (OK)
matplotlib >=2.0.0              :  3.3.2 (OK)
numpy >=1.7                     :  1.19.4 (OK)
pandas >=1.1.1                  :  1.1.4 (OK)
scipy >=0.17.0                  :  1.5.4 (OK)
sympy >=0.7.3                   :  1.6.2 (OK)

-------------------------------------





Discussion:
Hey @vernhow, thanks for reporting. Quick question for you: did you use our new Windows installer to install Spyder?
> Quick question for you: did you use our new Windows installer to install Spyder?

Based on the dependency versions all matching precisely, that seems almost certain. 

In any case, the title bar in any Spyder install method has always shown the version of Spyder's own Python runtime, so everything is behaving as expected here. Given the user can have multiple consoles open in different environments with different Python versions and freely switch among them, and they are fully independent of Spyder itself, I'm not sure what if anything else it would make sense to show in the title bar than Spyder's own runtime version.

However, this is really a relic of the days before we recommended and fully supported users separating their Spyder and working envs (and before the status bar widget), especially given that with our new installers, users may not even know that Spyder itself is written in Python and be confused by the Python version shown in the title bar. Therefore, I would suggest just removing it. For the vast majority of users Spyder's runtime version shouldn't make a difference and its still displayed in the console and the status bar if they are actually using it to run their code, so the only purpose it serves there is to cause confusion (as it did here). If users need that information, they can easily get it from the About dialog.
> Therefore, I would suggest just removing it

I agree, but only for the Windows and Mac apps. It's still useful if you install Spyder in multiple envs.

@dalthviz, @mrclary, what do you think?
> > Therefore, I would suggest just removing it
> 
> I agree, but only for the Windows and Mac apps. It's still useful if you install Spyder in multiple envs.
> 
> @dalthviz, @mrclary, what do you think?

I agree with @ccordoba12, sort-of. If one launches Spyder from different environments, it is useful to know from which environment it was launched, but maybe the Python version is not needed and can be known from the About dialog.

Would it be best to display the title bar as "Spyder (\<env\>)", where \<env\> is the environment type and name, e.g. "conda: my-env"? And, as @ccordoba12 suggests, for Windows and Mac apps the title bar would read "Spyder".
> Would it be best to display the title bar as "Spyder (<env>)", where is the environment type and name, e.g. "conda: my-env"? And, as @ccordoba12 suggests, for Windows and Mac apps the title bar would read "Spyder".

I do recall this being proposed, but we evidently never got around to implementing it. As of now, it only shows the Python runtime version, so unless users have a different version of Python in every env they have Spyder in, and remember which is which, it is not helpful in this regard. If we did implement it, that would be much more helpful than the Python version, at least for the case where it matters.

~~For developers like us who use multiple Spyders at once it makes sense, but I worry that for the average user, if they are following our recommended approach of keeping one copy of Spyder (either via the installers, Anaconda or one of our many other install methods) and using separate working environments, the information isn't needed and I worry they might be confused why the Python version or environment shown doesn't match that in their IPython console. And if they are not and instead using one Spyder for each working env, their working env name, version and type is now right in the statusbar as well as the IPython console, so not sure how much they need it in the window title unless they've disabled single instance and have several Spyders open at once...not sure how common that is; I've never seen it myself.~~ Eh, on second thought I don't think its really that big of a problem, and its definitely helpful for us and other power users, so as long as its removed in the standalone installers and we switch the rest over to using env name instead of/in addition to interpreter version, so its actually useful in identifying Spyder's running environment, I'm fine with it.
dear @ccordoba12 @CAM-Gerlach @mrclary , yes I used the standalone installer and had always wanted to run on Python 3.9 and no ulterior motive but its also because I'd wanted to move away from the Anaconda environment and do the pip installs whenever required. So this works but is reassuring to note that its mainly a "display" - well yes having the display set as showing the "root" dir or the env as an additional indicator would be useful. Then again, I hope that setting the path is the right things as Am still new to the venv practice myself. 
@vernhow Hey, not sure how much you understood from our discussion since it was pretty technical, but to avoid any confusion, let me explain what you're seeing here (which I should have before, sorry):

Spyder itself is written in Python, and runs on its own Python interpreter, which is the the version shown in the title bar. This is currently Python 3.7 as bundled with the standalone installers, or is whatever version of Python you have in the environment you install Spyder in, if you use it through Anaconda, a regular `pip` install, or one of our other distribution method. By default, if you haven't added the path to your own environment under the `Python interpreters` preference pane, new consoles will open in this environment.

If you do configure paths to your own Python interpreters/environments (venv/virtualenv, conda env, pyvenv, system Python, etc), then new IPython consoles (that run your code and you can interact with) will open in the environment(s) of your choosing, but Spyder itself still runs in its own environment, so you only have to keep one copy installed and changes you make in your environments won't break Spyder. Since the version in the title bar shows the environment that the Spyder application is running in, it won't change if you launch a Console in a different one (and it doesn't really make sense to, since you can have multiple consoles open in many different environments and switch between them at will).

What we're proposing here is, at least for the standalone installer versions of Spyder, to no longer show this Python version in the window title bar, since the version of Spyder is using doesn't make any difference for the user running their own code and just causes confusion, as it did here, and the environment in which your code runs is shown in the IPython console and in the status bar. For more advanced users who install Spyder in one (or more) of their existing Python environments, we're proposing changing the title bar to show the environment name instead of/in addition to the interpreter version to make it easier for users to keep track where the current copy of Spyder their using is installed (especially true for advanced users and developers).

Does that make sense now?
Dear @CAM-Gerlach , it does make sense and I believe the scenario as you described is the one where the path I have defined is a system Python which is where the Python 3.9 is installed. I believe the the scenario for me is that I have an interpreter that runs on Python 3.9 and Spyder's internal software runtime is on Python3.7 but will not interfere with my editor and console style being operated in Python 3.9? 

![image](https://user-images.githubusercontent.com/20274116/101509592-e3e07780-39b3-11eb-9ff2-1607f839a2cf.png)

> for Windows and Mac apps the title bar would read "Spyder".

+1 about this option @ccordoba12 
Thanks for chiming in @dalthviz! I'll implement that right away.

Resolving patch:
diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py
--- a/spyder/app/mainwindow.py
+++ b/spyder/app/mainwindow.py
@@ -56,7 +56,7 @@
 from qtpy.QtGui import QColor, QDesktopServices, QIcon, QKeySequence
 from qtpy.QtWidgets import (QAction, QApplication, QDesktopWidget, QDockWidget,
                             QMainWindow, QMenu, QMessageBox, QShortcut,
-                            QStyleFactory, QWidget, QCheckBox)
+                            QStyleFactory, QCheckBox)
 
 # Avoid a "Cannot mix incompatible Qt library" error on Windows platforms
 from qtpy import QtSvg  # analysis:ignore
@@ -74,8 +74,7 @@
 # from clicking the Spyder icon to showing the splash screen).
 #==============================================================================
 from spyder import (__version__, __project_url__, __forum_url__,
-                    __trouble_url__, __website_url__, get_versions,
-                    __docs_url__)
+                    __trouble_url__, get_versions, __docs_url__)
 from spyder import dependencies
 from spyder.app import tour
 from spyder.app.utils import (create_splash_screen, delete_lsp_log_files,
@@ -84,7 +83,7 @@
 from spyder.config.base import (_, DEV, get_conf_path, get_debug_level,
                                 get_home_dir, get_image_path, get_module_path,
                                 get_module_source_path, get_safe_mode,
-                                reset_config_files, running_in_mac_app,
+                                is_pynsist, running_in_mac_app,
                                 running_under_pytest, STDERR)
 from spyder.config.gui import is_dark_font_color
 from spyder.config.main import OPEN_FILES_PORT
@@ -1427,6 +1426,8 @@ def set_window_title(self):
             title = u"Spyder %s (Python %s.%s)" % (__version__,
                                                    sys.version_info[0],
                                                    sys.version_info[1])
+        elif running_in_mac_app() or is_pynsist():
+            title = "Spyder"
         else:
             title = u"Spyder (Python %s.%s)" % (sys.version_info[0],
                                                 sys.version_info[1])
@@ -3613,7 +3614,7 @@ def main(options, args):
                 mainwindow = create_window(app, splash, options, args)
         else:
             mainwindow = create_window(app, splash, options, args)
-    except FontError as fontError:
+    except FontError:
         QMessageBox.information(None, "Spyder",
                 "Spyder was unable to load the <i>Spyder 3</i> "
                 "icon theme. That's why it's going to fallback to the "


Test patch: