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

Conversation

andfoy
Copy link
Member

@andfoy andfoy commented Mar 10, 2022

Description of Changes

This PR will generalize the functioning of the Run plugin, and more specifically, the Run button itself, which will allow plugins to register run inputs and executors in a generic way. This will enable plugins such as spyder-terminal to run scripts and plugin designers may create other interfaces that have an executable output, examples of this, some sort of graph editor, or even the future plots panel.

This is being done as part of the tasks necessary to migrate the editor to the new API and is being tracked as part of #17468

  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable)
  • Included a screenshot or animation (if affecting the UI, see Licecap)
sequenceDiagram
    autonumber
    actor User
    participant RunInputProvider as RunInputProvider[input T];
    participant Run
    participant RunExecutorProvider as RunExecutor[exec T]
    participant RunResultViewer as RunResultViewer[display U]
    par Providers are registered on plugin initialization
          RunInputProvider->>Run: register_input_provider
    and 
          RunExecutorProvider->>Run: register_run_executor
    and
          RunResultViewer->>Run: register_run_result_viewer
    end
    par The RunInputProvider is switched for the run button each time the focus changes
          User->>RunInputProvider: on_focus
          activate User
          RunInputProvider->>Run: update_run_focus
          deactivate User
    end
    par The user clicks the run button
          User->>Run: on_click
          activate User
          Run->>RunInputProvider: get_run_input
          activate RunInputProvider    
          RunInputProvider-->>Run: input:  class RunInformation[input T, display U]
          deactivate RunInputProvider
         Run->>Run: dispatch for input T
         alt There are multiple executors for run input type T
               Run->>User: Ask for executor
               User-->>Run: executor: class RunExecutorProvider[T]
         else There is a single executor for run input type T
               Run->>Run: executor: class RunExecutorProvider[T]
         end
         Run->>+RunExecutorProvider: executor.run_input(input: class RunInformation[T, U])
         RunExecutorProvider-->>-Run: run_result: class RunResult[U]
         Run->>Run: dispatch for result display U
         Run->>RunResultViewer: display_run_result(run_result: class RunResult[U])
         RunResultViewer-->>User: Display results
         deactivate User
    end
Loading

Issue(s) Resolved

Fixes #

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct:

Co-authored-by: Stephannie Jimenez Gacha <steff456@hotmail.com>
@andfoy andfoy added this to the v6.0alpha1 milestone Mar 10, 2022
@pep8speaks
Copy link

pep8speaks commented Mar 10, 2022

Hello @andfoy! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 245:9: E303 too many blank lines (2)

Line 248:34: E124 closing bracket does not match visual indentation

Line 162:13: E128 continuation line under-indented for visual indent
Line 166:13: E128 continuation line under-indented for visual indent

Line 192:5: E303 too many blank lines (2)
Line 223:31: E222 multiple spaces after operator
Line 490:9: E731 do not assign a lambda expression, use a def

Line 327:80: E501 line too long (83 > 79 characters)

Line 311:80: E501 line too long (80 > 79 characters)
Line 316:1: E302 expected 2 blank lines, found 1

Comment last updated at 2022-07-14 00:18:24 UTC

@andfoy andfoy changed the title PR: Generalize Run plugin to support generic inpúts and executors PR: Generalize Run plugin to support generic inputs and executors Mar 10, 2022
andfoy and others added 4 commits March 16, 2022 16:59
… Viewers

Co-authored-by: Stephannie Jimenez Gacha <steff456@hotmail.com>
Co-authored-by: Stephannie Jimenez Gacha <steff456@hotmail.com>
Co-authored-by: Stephannie Jimenez Gacha <steff456@hotmail.com>
andfoy and others added 4 commits March 30, 2022 23:18
Co-authored-by: Stephannie Jimenez Gacha <steff456@hotmail.com>
…tors

Co-authored-by: Stephannie Jimenez Gacha <steff456@hotmail.com>
Co-authored-by: Stephannie Jimenez Gacha <steff456@hotmail.com>
andfoy and others added 8 commits May 9, 2022 18:36
Co-authored-by: Stephannie Jimenez Gacha <steff456@hotmail.com>
Co-authored-by: Stephannie Jimenez Gacha <steff456@hotmail.com>
Co-authored-by: Stephannie Jimenez Gacha <steff456@hotmail.com>
Co-authored-by: Stephannie Jimenez Gacha <steff456@hotmail.com>
Co-authored-by: Stephannie Jimenez Gacha <steff456@hotmail.com>
Co-authored-by: Stephannie Jimenez Gacha <steff456@hotmail.com>
- They are no longer needed because those widgets are now populated by
the Run plugin.
- Also, fix adding the Run toolbar to new Editor windows.
@ccordoba12
Copy link
Member

ccordoba12 commented Feb 15, 2023

I think this is ready, so let's merge it. It still requires more work but that can be done in follow up PRs.

Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andfoy and @steff456 for your work on this.

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

Successfully merging this pull request may close these issues.

5 participants