ProjectPythia / gridding-cookbook

Small cookbook to review xarray gridding
https://projectpythia.org/gridding-cookbook/
Apache License 2.0
8 stars 3 forks source link

Broken code in xESMF notebook #16

Closed brian-rose closed 1 year ago

brian-rose commented 1 year ago

Currently the xESMF notebook throw exceptions at package import and does not run to completion:

ModuleNotFoundError: No module named 'ESMF'

It's not clear to me why these errors don't cause a build failure flag, since we have

allow_errors: False

in the config file.

brian-rose commented 1 year ago

One reason why the nightly-build flag is reporting success is because the badge is pointing to the wrong repo (i.e., the template repo). This will be fixed in https://github.com/ProjectPythia/gridding-cookbook/pull/15

The correct badge for this repo is: nightly-build

which is still reporting success despite the notebook exception found in the build logs

brian-rose commented 1 year ago

Digging into this.

The reason why the notebook exceptions don't trigger a build failure is because the default value of the nb_execution_raise_on_error flag in myst-nb is false

This is not a gridding-cookbook issue per se, but I will use the failure in this cookbook as a test case. We should set the flag

nb_execution_raise_on_error: true

somewhere in the config file.

brian-rose commented 1 year ago

There is no mention of this flag in the JupyterBook documentation.

Digging through the JupyterBook code, it looks like execution flags in the _config file are passed through to sphinx and its extensions here. There is no nb_execution_raise_on_error flag in this list.

Maybe this just hasn't been implemented yet in JupyterBook?

I will open an issue about this.

brian-rose commented 1 year ago

Issue is now open at https://github.com/executablebooks/jupyter-book/issues/2011

brian-rose commented 1 year ago

There's a simple workaround, which is to put the following in the _config file:

sphinx:
  config:
    nb_execution_raise_on_error: true 

I implemented this in the Cookbook Template in https://github.com/ProjectPythia/cookbook-template/pull/117

ThomasMGeo commented 1 year ago

@brian-rose anything I can do to fix this now?

brian-rose commented 1 year ago

@brian-rose anything I can do to fix this now?

I'm not sure if the import error got resolved with upstream changes. I just opened #17 to get the repo up to speed with latest changes in the cookbook template. If that PR builds without error, then we can close this.

brian-rose commented 1 year ago

17 fixes the problem with xESMF