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

PR: Generalize Run plugin to support generic inputs and executors #17467

Merged
merged 102 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
d89e4b4
Start Run plugin generalization
andfoy Mar 10, 2022
c103a55
Finish typing stubs and Run API interfaces
andfoy Mar 10, 2022
cb61372
Add register and deregister methods for InputProviders, Executors and…
andfoy Mar 16, 2022
a1b920c
Merge remote-tracking branch 'upstream/master' into split_run_editor
andfoy Mar 17, 2022
dbb2bf6
Fix docstrings and some interface naming
andfoy Mar 27, 2022
738e0fa
Move context and extension to run configuration metadata
andfoy Mar 29, 2022
e26c41f
Start working on the new Run dialog
andfoy Mar 30, 2022
5a00314
Define abstract models for both model configurations as well as execu…
andfoy Apr 20, 2022
6e57446
Merge branch 'master' into split_run_editor
andfoy Apr 20, 2022
e4a986e
Register files from the editor
andfoy Apr 21, 2022
56dda5f
Fix issues with the run configuration combobox
andfoy May 9, 2022
2cd4f3f
Merge branch 'master' into split_run_editor
andfoy May 9, 2022
958fbf6
Deregister run configurations from the Editor
andfoy May 9, 2022
17800e9
Merge branch 'split_run_editor' of https://github.com/andfoy/spyder i…
andfoy May 9, 2022
8e89657
Make sure combobox follows the focused run configuration
andfoy May 10, 2022
ceffc24
Ensure executors combo box is updated correctly
andfoy May 16, 2022
ddd57c7
Load stored parameters from configuration
andfoy May 18, 2022
53a909f
Add combobox and checkbox to create new run configurations
andfoy May 23, 2022
1f3b28f
Decouple run parameters from files
andfoy May 24, 2022
7165efa
Per-executor configuration parameters are now being saved and loaded
andfoy May 26, 2022
6b4a065
Run is now working with files
andfoy May 27, 2022
0c1e651
Move external console options to a separate executor
andfoy May 30, 2022
7274b74
Add support for bash files
andfoy May 31, 2022
42996dc
Save last used parameters per file
andfoy Jun 1, 2022
4f1a388
Fix parameter initialization in dialog
andfoy Jun 1, 2022
48ac435
Add selection action
andfoy Jun 3, 2022
4e4077d
Add support for cells and script selection
andfoy Jun 4, 2022
a1ed3c7
Add support for cells and advance
andfoy Jun 7, 2022
53b8ca2
Merge branch 'master' into split_run_editor
andfoy Jun 7, 2022
cad2038
Try to override shortcuts
andfoy Jun 7, 2022
79a485b
Add run to/from line actions
andfoy Jun 7, 2022
978a59e
Add open configuration dialog action
andfoy Jun 8, 2022
35ab62f
Add re-run last file action
andfoy Jun 8, 2022
1c0d828
Add re-run cell option
andfoy Jun 9, 2022
23c7520
Migrate Profiler to use the new Run API
andfoy Jun 10, 2022
bfec106
Get around Python scope limitations
andfoy Jun 10, 2022
28a6e92
Move Pylint to use the new Run infraestructure
andfoy Jun 13, 2022
bb91bb0
Add teardown routines for Run methods and dependencies
andfoy Jun 13, 2022
b9f395b
Start re-working the Run configuration page
andfoy Jun 14, 2022
bba8245
Add configuration page edition dialog
andfoy Jun 15, 2022
22e2932
Configuration page is now working as expected
andfoy Jun 17, 2022
9069f26
Remove unwanted import
andfoy Jun 20, 2022
4761fca
Ensure powershell and cmd work as expected
andfoy Jun 20, 2022
c8401f3
Start fixing fast tests
andfoy Jun 20, 2022
748342d
Merge remote-tracking branch 'upstream/master' into split_run_editor
andfoy Jun 20, 2022
99da57b
Rename action to make it visible in macOS
steff456 Jun 20, 2022
3b5716b
Merge branch 'master' into split_run_editor
andfoy Jun 21, 2022
717d9c2
Fix mainwindow tests
andfoy Jun 21, 2022
8550e23
Merge with master
andfoy Jun 21, 2022
cbf6d4f
Add temporary run api to debug files
andfoy Jun 21, 2022
f3f413a
Fix cell copy options
andfoy Jun 21, 2022
edc8532
Fix a few more tests
andfoy Jun 21, 2022
01ac4df
Fix remaining tests
andfoy Jun 22, 2022
836626a
Merge branch 'master' into split_run_editor
andfoy Jun 23, 2022
b1e958f
Merge remote-tracking branch 'upstream/master' into split_run_editor
andfoy Jun 23, 2022
4a1339d
Fix test_connection_to_external_kernel
andfoy Jun 24, 2022
9b5dd10
Add external console test
andfoy Jun 27, 2022
17612ce
Fix shell test in Windows
andfoy Jun 27, 2022
4f5c406
Apply review comments
steff456 Jun 28, 2022
8a05705
Inherit RunExecutor from QObject in order to ensure MRO resolution
andfoy Jun 28, 2022
8fd758e
Add API versioning how-to
andfoy Jun 28, 2022
90951bc
Fix pep8 issues
steff456 Jun 29, 2022
f6a13f7
Merge branch 'master' into split_run_editor
andfoy Jun 29, 2022
54bdaff
Add comments to fix test on windows CI
steff456 Jun 30, 2022
41a08d9
Merge branch 'split_run_editor' of github.com:andfoy/spyder into spli…
steff456 Jun 30, 2022
a65c8a8
Fix failing test in frames
steff456 Jun 30, 2022
25ab1f3
Refactor run dialog to use async Qt API
andfoy Jul 1, 2022
0986382
Extend test to run an input in transient mode
andfoy Jul 2, 2022
a72dde9
Extend test to consider subordinate contexts
andfoy Jul 5, 2022
77b5422
Use Run button instead of shortcut on test_varexp_rename
andfoy Jul 5, 2022
5c68b36
Merge branch 'master' into split_run_editor
andfoy Jul 5, 2022
85eb1a4
Test teardown deregistration for Run
andfoy Jul 5, 2022
e059967
Try to prevent duplicate shortcuts
andfoy Jul 7, 2022
d223b4c
Group some run tests
andfoy Jul 11, 2022
cd7d70c
Skip test_runcell_edge_cases
andfoy Jul 11, 2022
4df2264
Skip test_runcell_pdb on Windows
andfoy Jul 11, 2022
c5b14e9
Fix typo
steff456 Jul 12, 2022
89e2d4d
Skip test_runcell_cache on Windows
andfoy Jul 12, 2022
fee8db9
Merge branch 'split_run_editor' of https://github.com/andfoy/spyder i…
andfoy Jul 12, 2022
10542d3
Skip test_runcell_after_restart on Windows
andfoy Jul 12, 2022
ffbf1e3
Move test_varexp_remove to call the Run button directly
andfoy Jul 12, 2022
d84f28a
Increase timeout on test_print_multiprocessing
andfoy Jul 13, 2022
48965d3
Fix issues with whitespaces when running shell files
andfoy Jul 13, 2022
45d5053
Retrieve run configurations for super contexts via get_run_configurat…
andfoy Jul 13, 2022
b64f181
Force editor to set focus appropiately in test_print_multiprocessing
andfoy Jul 13, 2022
3204b63
Add wait for test_print_faulthandler
andfoy Jul 13, 2022
7020323
Fix Run configuration page table issues
andfoy Jul 13, 2022
500887c
Display only the executors that have a configuration dialog
andfoy Jul 13, 2022
ebf2b63
Add wait time to refresh run file in test_debug_unsaved_function
andfoy Jul 14, 2022
646f321
Merge after releasing 5.3.3
ccordoba12 Feb 3, 2023
0e80241
Merge after releasing 5.4.0
ccordoba12 Feb 4, 2023
8ede54f
Merge after releasing 5.4.1
ccordoba12 Feb 5, 2023
1c156b7
Fix line endings of batch scripts
ccordoba12 Feb 5, 2023
0e07d4a
Merge branch 'master' into split_run_editor
ccordoba12 Feb 5, 2023
58525e3
Testing: Refactor code used to generate run parameters
ccordoba12 Feb 5, 2023
4d42430
Main Window: Remove attributes related to the Run menu and toolbar
ccordoba12 Feb 5, 2023
fd12df1
Testing: Fix most failing tests and skip others
ccordoba12 Feb 5, 2023
8215c66
Debugger: Fix debugging selections
ccordoba12 Feb 7, 2023
5304a54
Ignore revision that updated the new run architecture with master
ccordoba12 Feb 9, 2023
b4782dc
Merge branch 'master' into split_run_editor
ccordoba12 Feb 11, 2023
4068d25
Add some missing docstrings, fix style issues and other minor things
ccordoba12 Feb 11, 2023
5cf60eb
Testing: Skip test_shell_execution on Mac because it's failing
ccordoba12 Feb 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add open configuration dialog action
Co-authored-by: Stephannie Jimenez Gacha <steff456@hotmail.com>
  • Loading branch information
andfoy and steff456 committed Jun 8, 2022
commit 978a59e63549f06ccd83c9ae8aa7542739b77b85
39 changes: 18 additions & 21 deletions spyder/plugins/editor/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import time
import uuid
from datetime import datetime
from typing import Dict
from typing import Dict, Optional

# Third party imports
from qtpy.compat import from_qvariant, getopenfilenames, to_qvariant
Expand Down Expand Up @@ -787,17 +787,6 @@ def get_plugin_actions(self):
add_shortcut_to_tip=True)

# --- Run toolbar ---
configure_action = create_action(
self,
_("&Configuration per file..."),
icon=ima.icon('run_settings'),
tip=_("Run settings"),
menurole=QAction.NoRole,
triggered=self.edit_run_configurations)

self.register_shortcut(configure_action, context="_",
name="Configure", add_shortcut_to_tip=True)

re_run_action = create_action(self, _("Re-run &last script"),
icon=ima.icon('run_again'),
tip=_("Run again last file"),
Expand Down Expand Up @@ -1190,7 +1179,7 @@ def get_plugin_actions(self):
# ---- Run menu/toolbar construction ----
run_menu_actions = [re_run_last_cell_action, MENU_SEPARATOR,
re_run_action,
configure_action, MENU_SEPARATOR]
MENU_SEPARATOR]
self.main.run_menu_actions = (
run_menu_actions + self.main.run_menu_actions)
run_toolbar_actions = []
Expand Down Expand Up @@ -1260,7 +1249,7 @@ def get_plugin_actions(self):
)
self.pythonfile_dependent_actions = [
#run_action,
configure_action,
#configure_action,
set_clear_breakpoint_action,
set_cond_breakpoint_action,
self.debug_action,
Expand All @@ -1272,7 +1261,7 @@ def get_plugin_actions(self):
blockcomment_action,
unblockcomment_action,
]
self.cythonfile_compatible_actions = [configure_action]
# self.cythonfile_compatible_actions = [configure_action]
ccordoba12 marked this conversation as resolved.
Show resolved Hide resolved
self.file_dependent_actions = (
self.pythonfile_dependent_actions +
[
Expand Down Expand Up @@ -1957,10 +1946,7 @@ def opened_files_list_changed(self):
cython_enable = python_enable or (
programs.is_module_installed('Cython') and editor.is_cython())
for action in self.pythonfile_dependent_actions:
if action in self.cythonfile_compatible_actions:
enable = cython_enable
else:
enable = python_enable
enable = python_enable
action.setEnabled(enable)
self.sig_file_opened_closed_or_updated.emit(
self.get_current_filename(), self.get_current_language())
Expand Down Expand Up @@ -3059,7 +3045,7 @@ def get_run_configuration(self, metadata_id: str) -> RunConfiguration:
return run_conf

def get_run_configuration_per_context(
self, context, action_name) -> RunConfiguration:
self, context, action_name) -> Optional[RunConfiguration]:
editorstack = self.get_current_editorstack()
fname = self.get_current_filename()
__, filename_ext = osp.splitext(fname)
Expand All @@ -3068,7 +3054,11 @@ def get_run_configuration_per_context(
context_name = None
if context == RunContext.Selection:
if action_name == 'to line':
text, offsets, line_cols, enc = editorstack.run_to_line()
ret = editorstack.run_to_line()
if ret is not None:
text, offsets, line_cols, enc = ret
else:
return
elif action_name == 'line':
text, offsets, line_cols, enc = editorstack.run_from_line()
else:
Expand Down Expand Up @@ -3103,6 +3093,13 @@ def get_run_configuration_per_context(
metadata=metadata)
return run_conf

def focus_run_configuration(self, uuid: str):
ccordoba12 marked this conversation as resolved.
Show resolved Hide resolved
fname = self.file_per_id[uuid]
editorstack = self.get_current_editorstack()
current_fname = self.get_current_filename()
if current_fname != fname:
editorstack.set_current_filename(fname)

@Slot()
def edit_run_configurations(self):
dialog = RunConfigDialog(self)
Expand Down
5 changes: 3 additions & 2 deletions spyder/plugins/editor/widgets/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2743,9 +2743,10 @@ def _run_lines_cursor(self, direction):
elif direction == 'down':
cursor.movePosition(QTextCursor.End, QTextCursor.KeepAnchor)

code_text, off_pos, line_col_pos = (
ret = (
ccordoba12 marked this conversation as resolved.
Show resolved Hide resolved
editor.get_selection_as_executable_code(cursor))
if code_text:
if ret:
code_text, off_pos, line_col_pos = ret
return code_text.rstrip(), off_pos, line_col_pos, enc

def run_to_line(self):
Expand Down
30 changes: 27 additions & 3 deletions spyder/plugins/run/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@ class StoredRunConfigurationExecutor(TypedDict):
# if using default or transient settings.
selected: Optional[str]

# If True, then the run dialog will displayed every time the run
# configuration is executed. Otherwise not.
display_dialog: bool

# True if the configuration has been executed in the past, False
# otherwise.
first_execution: bool


class RunConfigurationProvider:
"""
Expand Down Expand Up @@ -276,7 +284,7 @@ def get_run_configuration(self, uuid: str) -> RunConfiguration:

def get_run_configuration_per_context(
self, context: str,
action_name: Optional[str] = None) -> RunConfiguration:
action_name: Optional[str] = None) -> Optional[RunConfiguration]:
"""
Return the run information for the given context.

Expand All @@ -295,13 +303,29 @@ def get_run_configuration_per_context(

Returns
-------
configuration: RunConfiguration
configuration: Optional[RunConfiguration]
A dictionary containing the information required by the run
executor.
executor. If None, then the provider indicates to the Run plugin
that the input needs to be discarded.
"""
raise NotImplementedError(f'{type(self)} must implement '
'get_run_configuration_per_context')

def focus_run_configuration(self, uuid: str):
"""
Switch the focus of the run configuration provider to
the run configuration given by parameter.

Arguments
---------
context: str
The unique identifier for the run configuration that should be
focused on, such id should have been registered previously via
`register_run_configuration_metadata` on the Run plugin.
"""
raise NotImplementedError(f'{type(self)} must implement '
'focus_run_configuration')


RunExecuteFunc = Callable[
[RunConfiguration, ExtendedRunExecutionParameters],
Expand Down
Loading