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

Skipping cells during execution #37

Closed
amardeep opened this issue Jan 31, 2023 · 8 comments · Fixed by #44
Closed

Skipping cells during execution #37

amardeep opened this issue Jan 31, 2023 · 8 comments · Fixed by #44
Assignees

Comments

@amardeep
Copy link

It would be good to have a way to skip certain cells during execution of jupyter notebooks.

My use case is that it is useful to have extra cells which might be useful for a developer while debugging or during interactive development - but shouldn't be run in regular runs.

But there are other scenarios discussed in the thread here:
nteract/papermill#429

@edublancas
Copy link
Contributor

edublancas commented Jan 31, 2023

I quickly skimmed through papermill's issue. looks like the community is in favor of a remove feature instead of a skip one since skipping will create non-linearly executed notebooks.

I think we can start with a simple implementation and improve it with community feedback: we can have the executor remove cells tagged with a specific tag and then execute the notebook. Would this work for you?

Something like:

ploomber-engine input.ipynb output.ipynb --remove-tagged-cells some-tag

@idomic
Copy link
Contributor

idomic commented Jan 31, 2023

Maybe worth making it static so you don't need to pass it as a var each time..

ploomber-engine input.ipynb output.ipynb

And in input.ipynb mark those cells with a remove tag.

@edublancas
Copy link
Contributor

Maybe worth making it static so you don't need to pass it as a var each time..

I thought the same at the beginning, but since this will affect the execution flow, I think it's better to be explicit.

@idomic
Copy link
Contributor

idomic commented Jan 31, 2023

We should do it explicitly, and then make sure we support an external file or an env variable so users don't have to repeat those multiple times.

@edublancas
Copy link
Contributor

edublancas commented Jan 31, 2023

external file or an env variable

this is more work than just the remove feature so I think we should split in two issues. this one should only cover the cell removing part.

@idomic
Copy link
Contributor

idomic commented Jan 31, 2023

Yeah, I'll reference a new issue.

@amardeep
Copy link
Author

amardeep commented Feb 1, 2023

I quickly skimmed through papermill's issue. looks like the community is in favor of a remove feature instead of a skip one since skipping will create non-linearly executed notebooks.

I think we can start with a simple implementation and improve it with community feedback: we can have the executor remove cells tagged with a specific tag and then execute the notebook. Would this work for you?

Something like:

ploomber-engine input.ipynb output.ipynb --remove-tagged-cells some-tag

Yes, that works. Thank you.

@edublancas
Copy link
Contributor

released in version 0.0.21!

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 a pull request may close this issue.

3 participants