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

Execute notebook programatically has different behavior from running it on a Jupyter Notebook UI #136

Open
noklam opened this issue Jan 18, 2024 · 0 comments

Comments

@noklam
Copy link

noklam commented Jan 18, 2024

Context

I am creating a Jupyter magic that will create multiple cells. When I run it manually (i.e. Ctrl + Enter), I can create new cells successfully. When I run it programatically, the code get run without error but the cells are not created.

A gif to show how this magic should behave.
image

See: kedro-org/kedro#3510

I am trying to create automated test for this feature, thus it is important to execute this in an automated fashion. I wonder how this is tested

import nbformat
from nbconvert.preprocessors import ExecutePreprocessor

ep = ExecutePreprocessor(timeout=600, kernel_name="python3")
print(f"Executing Notebook {notebook_filename}")
try:
    # Execute the notebook from the same directory
    ep.preprocess(nb,
                  {'metadata': {'path': Path(notebook_filename).parent.resolve()}})

I wonder if you have any idea why it doesn't work, or you can give me some pointers to some relevant tests in this repository. Thank you in advance!

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

1 participant