Rhodes-CS-Department / jupyterhub-deployment

Configs and READMEs for Rhodes CS JupyterHub deployment
2 stars 1 forks source link

Auto-grant trust for new notebooks cloned from the repo #14

Open ml8 opened 3 years ago

ml8 commented 3 years ago

Execution dependencies require trust to be granted to a notebook, otherwise they don't work on initial open. Running cells and saving a notebook generates trust, but it would be nice if users never saw the "untrusted" message (it's scary).

Adding a lifecycle hook would work, but with a small (35) number of notebooks, this takes 30s (even if all notebooks are already trusted/signed).

jovyan@jupyter-langma-40gmail-2ecom:~$ time find comp141-materials -regex .*ipynb -exec jupyter trust {} \;
[...snip...]
real    0m34.916s
user    0m7.175s
sys     0m1.538s
jovyan@jupyter-langma-40gmail-2ecom:~$

It would be nice to have this happen more quickly.

ml8 commented 3 years ago

This sort of thing works, but seems fragile and not worth doing right now...

touch .nb_list && \
  find comp141-materials -regex .*ipynb > .nb_list.tmp && \
  grep -v -f .nb_list .nb_list.tmp | xargs -r -d '\n' jupyter trust && \
  mv .nb_list.tmp .nb_list