Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to disable 'autosave notebook' permanently? #248

Closed
andrewchenshx opened this issue Jun 7, 2019 · 8 comments
Closed

how to disable 'autosave notebook' permanently? #248

andrewchenshx opened this issue Jun 7, 2019 · 8 comments
Milestone

Comments

@andrewchenshx
Copy link

Whenever a notebook is opened or refreshed, the 'autosave notebook'(File -> Jupytext -> Autosave Notebook) is enabled. How can i permanently turn OFF autosave?

@mwouts
Copy link
Owner

mwouts commented Jun 7, 2019

Hello @andrewchenshx , that's a great question.

The most extensive documentation I have found on the subject is on SO.

There also are at least two blogposts that describe in detail how to change the autosave frequency (same approach as the SO solution - you want 0):

Also, I know you're asking for Jupyter notebook, but the SO question mentions that the JupyterLab interface now has a control for this.

I think it would be a great thing to

Would you volunteer for that?

@andrewchenshx
Copy link
Author

andrewchenshx commented Jun 7, 2019

Hi @mwouts ,
Jupyter 4.4.0

  1. there does NOT exists the custom folder, either the custom.js, so i created the custom.js with following code
    define([ 'base/js/namespace', 'base/js/events' ], function(IPython, events) { events.on("notebook_loaded.Notebook", function () { IPython.notebook.set_autosave_interval(0); //in milliseconds } ); //may include additional events.on() statements } );
  2. having restarted the jupyter notebook, and then open a notebook, i find the menu item 'autosave notebook' is checked(while it's supposed to be unchecked).
  3. one more thing, i wonder why the 'autosave notebook' menu item is under the 'Jupytext' sub menu.

@mwouts
Copy link
Owner

mwouts commented Jun 7, 2019

Hi agree with 1. and 2. I just gave it a try (and add to create a custom folder). The custom.js documented above is uneffective, and even shows an error in the browser's console log.

I wonder why the 'autosave notebook' menu item is under the 'Jupytext' sub menu

Oh, this is because there was no such entry in the notebook menu already. I know very little JS so it was much simpler for me to put it at the same place as the other Jupytext commands. But you're correct, this is not specific to Jupytext (except that autosave tends to be an issue when you edit files from both Jupyter and elsewhere, which I support Jupytext users tend to do more than others).

Maybe we should look for another solution. Could you give a try to the autosavetime extension? Instructions are here, basically it's:

pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install
jupyter nbextension enable autosavetime/main

and then, you still need to go to the nbextension panel, and set autosave to zero. Please let us know if that works.

@andrewchenshx
Copy link
Author

1)when the option 'Set an autosave interval on notebook load' is Unchecked, the autosave interval is NOT saved in notebook, once u refresh, the interval u set last time is lost.
2)to disable 'autosave notebook', just make the option ' Set an autosave interval on notebook load' Checked, and set the 'Autosave interval (in minutes) which would be set on notebook load' param to 0, then autosave interval will be displayed as 'off' in the toolbar. although the 'Autosave Notebook' menu item(File -> Jupytext -> Autosave Notebook) is still checked

@mwouts
Copy link
Owner

mwouts commented Jun 11, 2019

Thanks for your feedback. I have shared our research back to stackoverflow, as I think people will prefer to use the extension rather than the custom.js file.

Also, I agree with you, the check box in the Jupytext menu is not right - I will see how to fix this.

mwouts added a commit that referenced this issue Jun 13, 2019
@mwouts
Copy link
Owner

mwouts commented Jun 14, 2019

@andrewchenshx , could you please give a try to the new RC?

pip install jupytext==1.1.7.dev0

Do you get the autosave unchecked as expected?

@mwouts mwouts added this to the 1.1.7 milestone Jun 15, 2019
@andrewchenshx
Copy link
Author

@mwouts , 1.1.7.dev0 works!

@mwouts
Copy link
Owner

mwouts commented Jun 18, 2019

Excellent - thanks for letting me know!

@mwouts mwouts mentioned this issue Jun 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants