You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
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.
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.
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.
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:
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.
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.
Activity
karthiknadig commentedon Jan 12, 2021
Transferring this Jupyter extension, since the code to figure the blocks of code between
#%%lies in the jupyter extension.rchiodo commentedon Jan 14, 2021
This is the same as:
Run Selection/Line in Python Terminalbut making it easier to define what the selection is. This would be something the python extension would be responsible for.rchiodo commentedon Jan 14, 2021
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.
adamal commentedon Jan 14, 2021
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.
karthiknadig commentedon Jan 15, 2021
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.
adamal commentedon Jan 18, 2021
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:
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.luabud commentedon Mar 10, 2021
Claudia Regio (@claudiaregio) is this something you'd like to see implemented?
luabud commentedon Mar 24, 2021
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.
diogo-rossi commentedon Jun 19, 2021
Adam (@adamal), there is a setting
"jupyter.enableCellCodeLens"that can be set tofalseto remove Cell's options in the editor