nbdev icon indicating copy to clipboard operation
nbdev copied to clipboard

NBs becoming untrusted in save hook

Open jph00 opened this issue 3 years ago • 1 comments

Currently NBs become untrusted when saving, if using the save hook.

jph00 avatar Aug 18 '22 01:08 jph00

I've been looking into this and there seem to be quite a few issues with Jupyter's trust system with hooks completely disabled. I'm not sure when/why these first appeared. See section below for more.

One idea would be to allow users to opt-in to completely disabling the trust system for notebooks in nbdev repos by configuring a repo-specific setting (e.g. trust_nbs = True). I'm not yet sure if this is possible or if its a good idea, will tinker some more. Another idea would be to deal with the current behaviour until its fixed upstream (or try make a PR). @hamelsmu @jph00 what do you think?

Jupyter trust issues

Creating a cell of any type breaks trust in Notebook

I haven't seen an issue tracking this in the Notebook repo. https://github.com/jupyterlab/jupyterlab/issues/9765 is similar but is in Lab.

Repro:

  1. Open any notebook
  2. Trust it (click the "Untrusted" button on the top-right)
  3. Create a cell of any type - it should remain trusted (should show "Trusted" on the top-right)
  4. Refresh the page - it will now be untrusted

This isn't the case in Lab. For example, creating a code cell with source "1" keeps trust in Lab.

Markdown cells break trust in Lab

This is being tracked in: https://github.com/jupyterlab/jupyterlab/issues/12889. It's a different issue to the previous and only affects Lab.

Repro:

  1. Open any notebook
  2. Trust it (open the command prompt and run "Trust Notebook")
  3. Create a blank code cell or markdown cell - it should now be untrusted (should show a shield with an x in the bottom-right)
  4. Trust it - it should still be untrusted
  5. Refresh the page - it should still be untrusted

seeM avatar Aug 23 '22 01:08 seeM