Skip to content

Add option to run cell in terminal #15151

Closed

Description

@adamal

Creating a line with
#%%
Defines a "cell" that can currently be run through Jupyter.
I have tried to use Jupyter for about a week for interactive development, but for various reasons, it isn't a good fit for me (tl;dr: too much ux overhead).

However, the ability to mark something as a cell and have a quick way to run that block without explicitly selecting the block first is great.

So I propose to add a command to Run Current #%%-cell in Terminal (i.e. not in Jupyter).

Similar functionality that already exists:
Run Cell in Jupyter -> opens a new tab with Jupyter with all its features and clutter.
Run Python File in Terminal
Run Selection/Line in Python Terminal

Activity

  1. karthiknadig commented on Jan 12, 2021

    @karthiknadig
    Member

    Transferring this Jupyter extension, since the code to figure the blocks of code between #%% lies in the jupyter extension.

  2. rchiodo commented on Jan 14, 2021

    @rchiodo

    This is the same as: Run Selection/Line in Python Terminal but making it easier to define what the selection is. This would be something the python extension would be responsible for.

  3. ghost added
    triage-neededNeeds assignment to the proper sub-team
    on Jan 14, 2021
  4. rchiodo commented on Jan 14, 2021

    @rchiodo

    Sorry it would probably make sense (if this enhancement were to be implemented) for the jupyter extension to allow another extension to do something else when 'running' a cell. So it's really both of our responsibility.

  5. adamal commented on Jan 14, 2021

    @adamal
    Author

    When posting the suggestion I did consider both extensions. And while the "run cell"-commands are prefixed with "Jupyter", I agree that the suggestion in principle doesn't have anything to do with Jupyter.
    A quick googling even suggested the #%%-cells originated in Spyder several years ago (also testifies to the feature's usefulness). So this is why I posted to the Python extension originally.

    I also see it was moved here for practical reasons, which for a feature this seemingly small, I can certainly appreciate.

    Perhaps the #%%-parsing logic, in principle, belongs in the Python extension, but moving it there for the sake of this feature might well be disproportional.
    In that case I would still hope you would consider implementing it here for the practical reasons outlined above.

  6. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Jan 15, 2021
  7. karthiknadig commented on Jan 15, 2021

    @karthiknadig
    Member

    We have marked this issue as "needs decision" to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 👍 votes the opening comment gets to help us make our decision.

  8. adamal commented on Jan 18, 2021

    @adamal
    Author

    Existing workaround

    The suggestion as stated is almost possible combining only existing commands from the Python/Jupyter etensions via another extension. Details in this SO-answer.
    The caveat is that you lose the cursor position.

    Suggested better solution

    After I started using this solution and going back to my editor, I re-noticed this part of the Jupyter UI additions:

    image

    When not using Jupyter, the "Run Cell | Run Above | Debug Cell" is less than useful. With many small cells, this ends up being a lot of clutter.

    That made me think of a slightly different approach to fulfilling the request:
    In stead of adding separate commands to run cells in terminal, it might be more useful to have an option to select "interpreter", which could then be terminal or Jupyter.

    Secondly, and this maybe should be a separate request, it is somewhat invasive for an extension to insert ui into editors, especially when triggered by syntax that has other uses.
    I can see there is already jupyter.decorateCells, but this only controls the (spacing neutral) horisontal dividers. This (or perhaps a new separate) setting should also control the presence of execution buttons in regular python files.

  9. luabud commented on Mar 10, 2021

    @luabud
    Member

    Claudia Regio (@claudiaregio) is this something you'd like to see implemented?

  10. luabud commented on Mar 24, 2021

    @luabud
    Member

    Thanks for the suggestion! We talked about it with the team offline and we have unfortunately decided we will not be moving forward with this idea. We think there isn't an enough widespread need for this to warrant the maintenance cost for the feature.

  11. diogo-rossi commented on Jun 19, 2021

    @diogo-rossi

    When not using Jupyter, the "Run Cell | Run Above | Debug Cell" is less than useful. With many small cells, this ends up being a lot of clutter.

    Adam (@adamal), there is a setting "jupyter.enableCellCodeLens" that can be set to false to remove Cell's options in the editor

  12. locked as resolved and limited conversation to collaborators on Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-terminalfeature-requestRequest for new features or functionalityinfo-neededIssue requires more information from poster

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions