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

Previous cell execution #121

Open
djangoliv opened this issue Jun 21, 2023 · 5 comments
Open

Previous cell execution #121

djangoliv opened this issue Jun 21, 2023 · 5 comments

Comments

@djangoliv
Copy link

Is it possible to run the previous notebook cell with ipylab?

I have a notebook with a cell with a button widget that runs unittests on the code in the cell above.

So it would be great to programmatically run the latest version of the code I want to test (which is in the previous cell) before.

Regards

@jtpio
Copy link
Owner

jtpio commented Jul 18, 2023

Looking at the list of available commands, maybe a combination of notebook:move-cursor-up and notebook:run-cell would work?

https://jupyterlab.readthedocs.io/en/latest/user/commands.html#commands-list

@erkin98
Copy link

erkin98 commented Sep 28, 2023

Looking at the list of available commands, maybe a combination of notebook:move-cursor-up and notebook:run-cell would work?

https://jupyterlab.readthedocs.io/en/latest/user/commands.html#commands-list

that make sense

@djangoliv
Copy link
Author

Thanks @jtpio

It's actually a good idea. However, I can't get it to work in a simple way.

When I execute the second cell, the first cell is indeed executed (twice even, I don't know why) but the result is still not usable.

image

@erkin98
Copy link

erkin98 commented Sep 28, 2023

would you try notebook:run-all-below after cursor up?

Thanks @jtpio

It's actually a good idea. However, I can't get it to work in a simple way.

When I execute the second cell, the first cell is indeed executed (twice even, I don't know why) but the result is still not usable.

image

@djangoliv
Copy link
Author

@erkin98 thank you for participating in the discussion

There are several problems with this idea:

  • The code in the second cell should not be re-executed, otherwise the code will loop.
  • But above all, I don't want to run my entire notebook which potentially contains other cells underneath.

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

No branches or pull requests

3 participants