Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No simple way to run Python files in an external terminal in 6.0.4 #23701

Open
athompson673 opened this issue Feb 10, 2025 · 5 comments
Open

Comments

@athompson673
Copy link
Contributor

After updating to spyder 6.0.4 from 6.0.3, changing the run configuration for a file to "External Terminal" will not apply until after a reboot. This does not apply to changing back to "IPython Console".

While debugging this, I could not find a way to set the default runner for new files. I can use run configuration per file, but how can I set external terminal the default for all (new) files? Rolling back through versions, it seems like this was lost from spyder 5 to 6?

Also github issue template not working?

Spyder info

  • Spyder version: 6.0.4 (pip)
  • Python version: 3.12.7 64-bit
  • Qt version: 5.15.2
  • PyQt5 version: 5.15.11
  • Operating System: Windows-10-10.0.19045-SP0
@ccordoba12
Copy link
Member

ccordoba12 commented Feb 10, 2025

After updating to spyder 6.0.4 from 6.0.3, changing the run configuration for a file to "External Terminal" will not apply until after a reboot. This does not apply to changing back to "IPython Console".

What do you mean exactly by this? Did you make some changes to the run configuration when "External Terminal" is selected and they didn't take effect immediately?

While debugging this, I could not find a way to set the default runner for new files. I can use run configuration per file, but how can I set external terminal the default for all (new) files? Rolling back through versions, it seems like this was lost from spyder 5 to 6?

Correct, there's no way to do that at the moment in Preferences, but we could come up with something for 6.0.5 if you think it's really important.

@athompson673
Copy link
Contributor Author

Media.mp4

I have not cleared any configs yet, but this should be well separated from my dev environment configs, so I think this was caused simply from a regular update process.

I can seemingly no longer even get it to consistently launch an external terminal even after rebooting spyder.

@athompson673
Copy link
Contributor Author

athompson673 commented Feb 10, 2025

I've tried taking a longer video of the behavior, but it's always too big for github... https://drive.google.com/file/d/1zrSUuDXhCrt8TT82E0ZHpG5QeUO44Bpn/view?usp=sharing

Here's my process to repeat the bug so far:

  • Delete .spyder-py3\config\transient.ini to reset the run configs
  • make a new file with print("hello world") and save
  • run it with default IPython console (works as expected)
  • open run config per file (ctrl-f6)
  • select "External Terminal" and hit OK
  • click run button (or f5): still runs in IPython console, and not in an external terminal
  • close spyder, and re-open
  • click run button: file runs first time in external terminal
  • click run button again: file runs in IPython terminal all subsequent times.

@ccordoba12
Copy link
Member

Ok, thanks for the detailed instructions. According to what you said:

click run button: file runs first time in external terminal

This is a bug. We should always run the file in the IPython console.

click run button again: file runs in IPython terminal all subsequent times.

That's the change I implemented in 6.0.4, i.e. to always use the IPython console to run Python files regardless of what's selected in Configuration per file (as I said before, it was quite confusing to use that dialog to set a runner besides configuring it).

I can seemingly no longer even get it to consistently launch an external terminal even after rebooting spyder.

Now you need to go to the menu entry Run > Run in external terminal. For 6.0.5 we could add a shortcut to that action so it's easier to trigger it.

@ccordoba12 ccordoba12 added this to the v6.0.5 milestone Feb 11, 2025
@ccordoba12 ccordoba12 changed the title Run configuration "external terminal" ignored until reboot No simple way to run Python files in an external terminal in 6.0.4 Feb 11, 2025
@athompson673
Copy link
Contributor Author

@ccordoba12

This is a bug. We should always run the file in the IPython console.
...
That's the change I implemented in 6.0.4, i.e. to always use the IPython console to run Python files regardless of what's selected in Configuration per file

This to me seems like a regression then to the functionality of being able to configure how code gets run. Generally I either have code that gets run in IPython, or it is for some reason incompatible and needs to be run externally (for example developing Qt applications). Basically it is generally only one or the other for me, and it doesn't change much for a given file, so configuring one as the default seems very correct and natural to me.

I understand it was somewhat inconsistent with the neighboring actions (run selection and run cell) always running in IPython, but that was actually quite useful in itself being able to use the more advanced features of IPython for small segments of code where running the entire file would crash unless run externally. I don't know about others, but it never seemed confusing to me that the actions which only partially ran code, or interacted in more advanced ways (ie: profiling/debugging) would ignore the external terminal setting (which did apply to the "run" action).

For 6.0.5 we could add a shortcut to that action so it's easier to trigger it.

To me that's really bare minimum. I would say a toolbar button would also be required, but really I would prefer a way to achieve the prior behavior. If it is confusing to use the same dialog to configure the runners and to select the default, would it be okay to have a separate dialog to select the "default runner" which is called with F5 or the "run" button? Maybe even dynamically change the icon on the run toolbar button based on the "default runner" (sticking with the ▶ and $ icons given in the menu)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants