ProjectPythia / cookbook-template

Project Pythia Cookbook template
https://projectpythia.org/cookbook-template/
Apache License 2.0
21 stars 16 forks source link

Build via binderbot #89

Closed brian-rose closed 1 year ago

brian-rose commented 1 year ago

Following successful experiments in https://github.com/ProjectPythiaCookbooks/cmip6-cookbook/pull/27 and https://github.com/ProjectPythia/pythia-foundations/pull/322, it's time to build the binderbot functionality into the template and (once it's working) push those changes out to all cookbook repos.

My recent refactor of the infrastructure makes this much easier. Most (all?) the changes will actually occur in the reusable workflows over at https://github.com/ProjectPythiaCookbooks/cookbook-actions.

What I have in mind is a python script that parses _config.yml and _toc.yml to get things needed for the call to binderbot:

That would all happen within the reusable https://github.com/ProjectPythiaCookbooks/cookbook-actions/blob/main/.github/workflows/build-book.yaml

One question is whether this should be automatic (i.e. every Cookbook executes this way), or whether there should be a switch for the individual Cookbook to choose whether to execute via binderbot or on GitHub Actions.

brian-rose commented 1 year ago

90 now has a working demo, and #91 shows how to disable binder-based execution.

brian-rose commented 1 year ago

I think now that the best path forward is to simplify the "switching" between using binderbot and executing on github actions.

Why not use the execute_notebooks field that's already in the _config.yml file. JupyterBook uses this field to decide whether / how to execute the notebooks. We could piggyback on this by adding a new option:

execute_notebooks: binder

The various workflows can parse this file to see if they should execute via binderbot, in which case we would manually set execute_notebooks: 'off' before calling jupyter-book build (we already do that for the link-checker action, e.g. https://github.com/ProjectPythia/pythia-foundations/blob/9e2dc028d62e4f203ecdae860822f2c8d16ca939/.github/workflows/link-checker.yaml#L33)

brian-rose commented 1 year ago

Why not use the execute_notebooks field that's already in the _config.yml file

with the eventual goal of migrating this functionality upstream into JupyterBook!

brian-rose commented 1 year ago

although the downside is that it would break jupyterbook build for local builds.

A backwards-compatible alternative would be to add new field to the execute section of _config.yml. But then "switching" between execution modes would require changing more than one field.

brian-rose commented 1 year ago

Discussed this at the IWG today 10/31/2022, got the green light to go ahead and mock something up that overrides the execute_notebooks field

brian-rose commented 1 year ago

I've implemented a solution for this, now merged into https://github.com/ProjectPythiaCookbooks/cookbook-actions

94 shows how we can now switch to binderbot-based execution just by setting execute_notebooks: binder in the _config.yml file.

brian-rose commented 1 year ago

96 does some final cleanup of the new template. Once that's merged, I think we can close this issue and propagate the changes out to all the existing cookbook repos.

brian-rose commented 1 year ago

Ok, closing this!