FIX Copy JupyterLite contents early so it runs before jupyterlite_sphinx build-finished#1213
Conversation
…inx build-finished
|
The CI errors are not related to this PR, probably an issue with libmamba ... Looking around, I did not find too much about these errors, conda-incubator/conda-store#632 mentions that is started happening a few days ago. It was worked around in conda-incubator/conda-store#634 by not mixing not mixing |
|
CI failures should be fixed by #1214 |
sphinx_gallery/gen_gallery.py
Outdated
| app.connect("builder-inited", generate_gallery_rst) | ||
| app.connect("build-finished", copy_binder_files) | ||
| app.connect("build-finished", create_jupyterlite_contents) | ||
| # Setting a small priority so that create_jupyterlite_contents runs before |
There was a problem hiding this comment.
| # Setting a small priority so that create_jupyterlite_contents runs before | |
| # Setting a low priority so that create_jupyterlite_contents runs before |
Just to avoid confusion.
There was a problem hiding this comment.
So I used small here on purpose rather than low. Callbacks are run in order of ascending priority so small priority means high priority (priority=100 means higher priority than priority=500 which is the default).
Maybe "setting priority to a small number" is less confusing. There is a similar in a comment a few lines above so it could be improved as well ...
There was a problem hiding this comment.
Ah I got myself confused, even after reading the docs.
"setting priority to a small number" sounds good!
There was a problem hiding this comment.
OK I tweaked the comments hopefully helping to avoid the confusion.
For reference, the connect doc says:
priority: The priority of the callback. The callbacks will be invoked in order of priority (ascending).
|
Hmmm actually thinking about it I think we also want copying the notebooks to be after generating the notebooks, I think the priority needs a bit more tweaking ... |
I think everything is good to go actually after thinking more about it. The notebooks are generated by |
Fix #1211.
I am not sure how to add a tests for this.
You want the notebooks copied to
jupyterlite_contentscopied before thejupyterlite_sphinxrunsjupyterlite build --contents jupyterlite_contents.I could also copy the contents in
builder-initedaftergenerate_gallery_rstnot sure which ones is less brittle.