Checkpoints and Autosaves under Jupyter

18,312 views
Skip to first unread message

Jean Bigboute

unread,
Jan 3, 2016, 7:21:55 PM1/3/16
to Project Jupyter
I often download Python tutorial notebooks from Github and go through them on my local machine. Notebook's Autosave updates the files as I am playing with them. If I want to discard my modifications and start fresh, the only way I seem to be able to is to either make a backup before starting or to download the notebook file again from Github.

I am running Python 2.7 via Anaconda on Mac OSX El Capitan 10.11.2 using Safari (mostly) and Firefox (occasionally).

Questions:
1) Is it possible to save more than one Checkpoint? If I save/restore, I only see one item in the Restore Checkpoint flyout

2) Is it possible to turn off Auto Save by default?

I found some threads on this for IPython notebooks using magics and config files. Magics have to be executed per notebook and I understand there have been changes to the config file system in general in Jupyter.

Unrelated question:  Is there a way to interact with this group from a newsreader?  gmane.comp.programming.jupyter allows reading but not posting.

MinRK

unread,
Jan 4, 2016, 4:20:06 AM1/4/16
to jup...@googlegroups.com

On Mon, Jan 4, 2016 at 1:21 AM, Jean Bigboute <jeanbi...@gmail.com> wrote:

I often download Python tutorial notebooks from Github and go through them on my local machine. Notebook's Autosave updates the files as I am playing with them. If I want to discard my modifications and start fresh, the only way I seem to be able to is to either make a backup before starting or to download the notebook file again from Github.

I am running Python 2.7 via Anaconda on Mac OSX El Capitan 10.11.2 using Safari (mostly) and Firefox (occasionally).

Questions:
1) Is it possible to save more than one Checkpoint? If I save/restore, I only see one item in the Restore Checkpoint flyout

With a custom CheckpointsManager, but not the default one. I’m not sure if there is one readily available that provides this.


2) Is it possible to turn off Auto Save by default?

Yes, in ~/.jupyter/custom/custom.js:

require(['base/js/namespace', 'base/js/events'], function (IPython, events) {
  events.on("notebook_loaded.Notebook", function () {
    IPython.notebook.minimum_autosave_interval = 0; // disable autosave

  });
});

-MinRK


I found some threads on this for IPython notebooks using magics and config files. Magics have to be executed per notebook and I understand there have been changes to the config file system in general in Jupyter.

Unrelated question:  Is there a way to interact with this group from a newsreader?  gmane.comp.programming.jupyter allows reading but not posting.

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/07d5a480-aca3-41e6-8285-d7e0a7a8b8fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sylvain Corlay

unread,
Jan 4, 2016, 4:45:39 AM1/4/16
to jup...@googlegroups.com

There also is an open issue about creating a mechanism for example notebooks so that one does not modify the examples accidentally.

(For example by adding a flag in the notebook file to say that it should be copied before being opened or should not be saved inplace by default.)

S.

Jean Bigboute

unread,
Jan 5, 2016, 12:56:39 AM1/5/16
to Project Jupyter
On Monday, January 4, 2016 at 1:20:06 AM UTC-8, Min RK wrote:

On Mon, Jan 4, 2016 at 1:21 AM, Jean Bigboute <jeanbi...@gmail.com> wrote:

...


Questions:
1) Is it possible to save more than one Checkpoint? If I save/restore, I only see one item in the Restore Checkpoint flyout

With a custom CheckpointsManager, but not the default one. I’m not sure if there is one readily available that provides this.


2) Is it possible to turn off Auto Save by default?

Yes, in ~/.jupyter/custom/custom.js:

require(['base/js/namespace', 'base/js/events'], function (IPython, events) {
  events.on("notebook_loaded.Notebook", function () {
    IPython.notebook.minimum_autosave_interval = 0; // disable autosave

  });
});

-MinRK



Thank you.  I created that custom.js file and I think it is working.

I searched for a Checkpoints Manager per your suggestion but didn't see anything that fit.  Is this part of the development plan for the Notebook or should I plan to save timestamped files should I need multiple Checkpoints down the line?

--- JBB

Jean Bigboute

unread,
Jan 5, 2016, 1:09:52 AM1/5/16
to Project Jupyter


On Monday, January 4, 2016 at 1:45:39 AM UTC-8, Sylvain Corlay wrote:

There also is an open issue about creating a mechanism for example notebooks so that one does not modify the examples accidentally.

(For example by adding a flag in the notebook file to say that it should be copied before being opened or should not be saved inplace by default.)

S.



Thanks.  I think that multiple Checkpoints would be a better way to go.  Or, perhaps, making Autosave off by default and controllable without having to edit a Custom JS file. 

Matthias Bussonnier

unread,
Jan 5, 2016, 2:58:05 AM1/5/16
to jup...@googlegroups.com

> On Jan 5, 2016, at 06:56, Jean Bigboute <jeanbi...@gmail.com> wrote:
>
> Thank you. I created that custom.js file and I think it is working.
>
> I searched for a Checkpoints Manager per your suggestion but didn't see anything that fit. Is this part of the development plan for the Notebook or should I plan to save timestamped files should I need multiple Checkpoints down the line?


>
> On Jan 5, 2016, at 07:09, Jean Bigboute <jeanbi...@gmail.com> wrote:
>
>
> Thanks. I think that multiple Checkpoints would be a better way to go. Or, perhaps, making Autosave off by default and controllable without having to edit a Custom JS file.

MultipleCheckpoint Manager is not on the roadmap on purpose. The API allows it, but the details and possibility of version control are too numerous be in core.

Autosave is on by default for good reason, discussed with great length, and it is always possible to revert to last manual save through the checkpoint menu,
so it will likely not be disable by default.
--
M

Jean Bigboute

unread,
Jan 5, 2016, 3:22:45 AM1/5/16
to Project Jupyter


On Monday, January 4, 2016 at 11:58:05 PM UTC-8, Matthias Bussonnier wrote:
...

> Thanks.  I think that multiple Checkpoints would be a better way to go.  Or, perhaps, making Autosave off by default and controllable without having to edit a Custom JS file.

MultipleCheckpoint Manager is not on the roadmap on purpose. The API allows it, but the details  and possibility of version control are too numerous be in core.

Autosave is on by default for good reason, discussed with great length, and it is always possible to revert to last manual save through the checkpoint menu,
so it will likely not be disable by default.


I'm puzzled by both decisions.  If I understand correctly, the Notebook, which is designed to encourage experimentation, is configured by default to regularly overwrite files on a filesystem with the user's only recourse being to manually save a single checkpoint in between automated overwrites.

I won't contest this but I am glad my other tools don't work this way.  

Matthias Bussonnier

unread,
Jan 5, 2016, 4:43:57 AM1/5/16
to jup...@googlegroups.com
Please look at the all history of the feature, in particular the PR corresponding to the IPep:



I won't contest this but I am glad my other tools don't work this way.  

You might not realize that but many tools behave this way. Especially in a browser if you do not want people to loose work.
Actually, even many desktop apps have this feature. I can restart my computer, and have various “unsaved” work being restored
at their current state.

Also please have a look at how checkpoint behave. You can perfectly work without ever manually triggering a save/checkpoint,
and your original file (if you downloaded it, or whatever) is still available.
-- 
M




Jean Bigboute

unread,
Jan 5, 2016, 5:02:40 PM1/5/16
to Project Jupyter


On Tuesday, January 5, 2016 at 1:43:57 AM UTC-8, Matthias Bussonnier wrote:


...deletia...

I'm puzzled by both decisions.  If I understand correctly, the Notebook, which is designed to encourage experimentation, is configured by default to regularly overwrite files on a filesystem with the user's only recourse being to manually save a single checkpoint in between automated overwrites.

Please look at the all history of the feature, in particular the PR corresponding to the IPep:



I won't contest this but I am glad my other tools don't work this way.  

You might not realize that but many tools behave this way. Especially in a browser if you do not want people to loose work.
Actually, even many desktop apps have this feature. I can restart my computer, and have various “unsaved” work being restored
at their current state.

Also please have a look at how checkpoint behave. You can perfectly work without ever manually triggering a save/checkpoint,
and your original file (if you downloaded it, or whatever) is still available.
-- 
M



I read the link and the reference to the author's original document contained in it.  I didn't understand most of it or the decisions behind picking the current construct.  But, this thread has given me a way to get the behavior that I need.  I've accordingly updated/adjusted how I use Jupyter when I need to use it.

Thanks,

--- JBB 

un.ol...@gmail.com

unread,
Aug 11, 2016, 10:37:03 AM8/11/16
to Project Jupyter


On Monday, January 4, 2016 at 10:20:06 AM UTC+1, Min RK wrote:

2) Is it possible to turn off Auto Save by default?

Yes, in ~/.jupyter/custom/custom.js:

require(['base/js/namespace', 'base/js/events'], function (IPython, events) {
  events.on("notebook_loaded.Notebook", function () {
    IPython.notebook.minimum_autosave_interval = 0; // disable autosave

  });
});

-MinRK


It does not work for me. I use Jupyter 4.1.1 and if I change a cell then the file is changed even if I don't save. I would have expected just changes in the  .ipynb_checkpoints directory but no, my file is changed which is a real pain with git.

BTW I still have autosave : Last Checkpoint: an hour ago (autosaved)
If setting minimum_autosave_interval = 0 means disable autosave, maybe I should not see (autosave) next to the title.

Please tell me there is a solution, I need both Jupyter and git! Now I do git checkout ten times a day, it is painfull.

Olivier.

Lawrence D’Oliveiro

unread,
Aug 14, 2016, 7:23:37 PM8/14/16
to Project Jupyter
On Tuesday, January 5, 2016 at 9:22:45 PM UTC+13, Jean Bigboute wrote:
If I understand correctly, the Notebook, which is designed to encourage experimentation, is configured by default to regularly overwrite files on a filesystem...

Not the *entire* filesystem, just one small part of it--the Jupyter notebooks directory.

Think of that as a work area. Anything important you want to save, you save elsewhere.

jonathan...@generalassemb.ly

unread,
Nov 7, 2016, 2:31:38 PM11/7/16
to Project Jupyter
This hasn't worked for me either, and I manage many repos where checkpoint files are dirty admin crud that I have to manually discard from commits every day. Has anyone found a solution?!?!?

DG

unread,
Mar 1, 2017, 12:00:22 AM3/1/17
to Project Jupyter
Like for many others, this DOES NOT WORK FOR ME.

I really dislike autosave. PLEASE give us a way to permanently turn that off.


Thank you.

dg





On Monday, January 4, 2016 at 1:20:06 AM UTC-8, Min RK wrote:

Matthias Bussonnier

unread,
Mar 1, 2017, 2:45:51 PM3/1/17
to jup...@googlegroups.com
On Tue, Feb 28, 2017 at 9:00 PM, DG <davide....@gmail.com> wrote:
> Like for many others, this DOES NOT WORK FOR ME.
>
> I really dislike autosave. PLEASE give us a way to permanently turn that
> off.
>

Things like this[1] allow you to tweak the save interval.
I believe an autosave interval of 0 (or negative values) disable it.
[1] is only a wrapper around custom.JS that already allows you to
tweak the value.

--
M
[1] https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tree/master/src/jupyter_contrib_nbextensions/nbextensions/autosavetime

DG

unread,
Mar 1, 2017, 11:14:34 PM3/1/17
to Project Jupyter
Sorry, NOT acceptable. I do NOT want to have to change every single notebook. Why should I?

I think there are many people who dislike the auto-save option. I will give you just one example. I like to have a master version of the notebook, then I want to experiment. When I experiment, I just DON"T SAVE. So the master remains unchanged. With autosave, my master notebook will change WITHOUT ME NOTICING. You say, you can revert to the last manual save, but that's a useless feature because next time I edit the master notebook, I may want to make a permanent change, after which I will manually save. This save will now contain both the desired changes as well as the unwanted one. Now I have lost the ability to revert. It's a complete mess. Please don't ask me to change my habit, which I have formed in decades of using computers--not going to happen. 

Regardless of whether the Jupyter notebook developers agree or not, many of us have some very good reasons why we want to turn off auto-save PERMANENTLY. It should be an easy option and a user's choice. 

Just please make a version of the custom JS file work. Is it too much to ask?  Don't make us conform to the tool, make the tool conform to what the user wants. 

Sorry for the rant, I get pretty worked up by things like those, having been burnt several times...

Paul Hobson

unread,
Mar 1, 2017, 11:25:23 PM3/1/17
to jup...@googlegroups.com
DG,

Perhaps you could take a stab at pulling together a pull request on Github. Many jupyter developers work very hard on it on their own time. It's impossible for them to anticipate every use case. And at any rate, their hard work has culminated in the creation of very powerful tools that are provided absolutely free as in both beer and speech. When you stop to think about the lineage of the notebook in context of Fernado's original "afternoon hack" on the standard python REPL, it's quite remarkable.

As a user, I've come across the situation you describe. We're all different in this world, but my firs thought was to use the File menu to create a copy, work on that, then incorporate any changes into or overwrite the notebook.
-Paul

Carol Willing

unread,
Mar 1, 2017, 11:56:39 PM3/1/17
to jup...@googlegroups.com
> Sorry for the rant, I get pretty worked up by things like those, having been burnt several times...

Hi DG,

Thanks for the apology.

Perhaps take a closer look at the information that Matthias provided. You can use the extension recommended by Matthias to add an autosave selector option to the notebook's toolbar.

See toolbar image.

By setting the extension's autosave parameters, you can customize the behavior of the extension including setting autosave to 0 as Matthias recommended.

Feel free to open an issue and discuss a PR if after giving the above a try the extension does not meet your needs.

Thanks,

Carol

--
Carol Willing

Research Software Engineer, Project Jupyter
Cal Poly San Luis Obispo

Director, Python Software Foundation

Strengths: Empathy, Relator, Ideation, Strategic, Learner
March 1, 2017 at 10:25 PM
--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
March 1, 2017 at 10:14 PM
Sorry, NOT acceptable. I do NOT want to have to change every single notebook. Why should I?

I think there are many people who dislike the auto-save option. I will give you just one example. I like to have a master version of the notebook, then I want to experiment. When I experiment, I just DON"T SAVE. So the master remains unchanged. With autosave, my master notebook will change WITHOUT ME NOTICING. You say, you can revert to the last manual save, but that's a useless feature because next time I edit the master notebook, I may want to make a permanent change, after which I will manually save. This save will now contain both the desired changes as well as the unwanted one. Now I have lost the ability to revert. It's a complete mess. Please don't ask me to change my habit, which I have formed in decades of using computers--not going to happen. 

Regardless of whether the Jupyter notebook developers agree or not, many of us have some very good reasons why we want to turn off auto-save PERMANENTLY. It should be an easy option and a user's choice. 

Just please make a version of the custom JS file work. Is it too much to ask?  Don't make us conform to the tool, make the tool conform to what the user wants. 

Sorry for the rant, I get pretty worked up by things like those, having been burnt several times...
--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
March 1, 2017 at 1:45 PM

Matthias Bussonnier

unread,
Mar 2, 2017, 12:09:52 AM3/2/17
to jup...@googlegroups.com
Hi DG,

Thanks for your long explanation. Let me respond to some of your comment
inline.

DG Said
> Sorry, NOT acceptable. I do NOT want to have to change every single
> notebook. Why should I?

The solution I gave you does not requires you to change every single
notebook. You can set your setting permanently within you custom.js file.

>
> I think there are many people who dislike the auto-save option. I will
> give you just one example.

Yes, like there were many people that lost data because no auto-save was in
place. And we had a large number who asked if we could do that and how they
could help to implement this, and we even exposed a configuration option to
set in your custom.js, which you are free to use.

I even liked you a group of user that made an extension for this to be
easier to configure.

> I like to have a master version of the notebook, then I want to
> experiment. When I experiment, I just DON"T SAVE. So the master remains
> unchanged. With autosave, my master notebook will change WITHOUT ME
> NOTICING. You say, you can revert to the last manual save, but that's a
> useless feature because next time I edit the master notebook, I may want
> to make a permanent change, after which I will manually save. This save
> will now contain both the desired changes as well as the unwanted one.
> Now I have lost the ability to revert. It's a complete mess. Please don't
> ask me to change my habit, which I have formed in decades of using
> computers--not going to happen.

I have been using computer for decades as well. I'm not always happy with
how things work, and I submit patches. That's how I ended up working on
Jupyter. Thing change also for good. Your browser crash ? You work is
saved. Your computer fell in water, things are on git/mercurial/svn/time
machine. We even provide pluggable content manager that track more than one
version if you like. Contributors have even written extensions that allow
to commit with from within a message!

> Regardless of whether the Jupyter notebook developers agree or not, many
> of us have some very good reasons why we want to turn off auto-save
> PERMANENTLY. It should be an easy option and a user's choice.

Sure do it, from custom.js, it's made for user configuration, and just
waiting for you. And that persistent across reload/refresh/reboot...

>
> Just please make a version of the custom JS file work. Is it too much to
> ask? Don't make us conform to the tool, make the tool conform to what the
> user wants.

Well, custom js is arbitrary code. Let's be optimistic and assume there are
32 symbols availlable in javascript. a-z space, {}, (), and a couple of
number, just to get 2**6. There already 2**60 custom.js possible with 10
caraters ! Imagine the number od options you have !

More resonably:

$ ipython --help-all | grep -e '^--[A-Z]' | sort | wc -l
106
$ python -m ipykernel --help-all | grep -e '^--[A-Z]' | wc -l
91
$ python -m notebook --help-all | grep -e '^--[A-Z]' | wc -l
112
$ jupyter nbconvert --help-all | grep -e '^--[A-Z]' | wc -l
179

So that's about 500 configuration option only for the backend (many of
these can't be auto discovered like that, and you have additional plugins).
And not all configuration options are counted, in particular the javascript
one.

So if you wish to help us write the User interface for these we would
happily guide you and include your Pull requests.

Shameless plug, notebook 5.0 will come with a UI to configure users
shortcut !

> Sorry for the rant, I get pretty worked up by things like those, having
> been burnt several times...

Sorry that has caused you trouble. I know loosing data or minutes of works
can be quite hard. I pested against GMail the other day for stupidely
pressing ESC and it does not save as draft if you don't have a recipient
apparently. I learn my lesson. You should not be afraid by writing a
maximum lines config files (my vimrc is 300 line long that's starting to be
scary) custom js is not that hard.

I know it can be hard to start, I think that the options you need are:

Jupyter.notebook.minimum_autosave_interval

Custom.js should be in your config directory ~/.jupyter/custom/custom.js
IIRC it comes with a large commented example on how to configure a few
thing. Might be a bit out of date though.


Paul Said

> DG,

> Perhaps you could take a stab at pulling together a pull request on
> Github. Many jupyter developers work very hard on it on their own time.
> It's impossible for them to anticipate every use case. And at any rate,
> their hard work has culminated in the creation of very powerful tools
> that are provided absolutely free as in both beer and speech. When you
> stop to think about the lineage of the notebook in context of Fernado's
> original "afternoon hack" on the standard python REPL, it's quite
> remarkable.

Thanks you Paul, that's deeply appreciated. We do think deeply about
everyone and we have to make some hard decision sometime. Keybinding closer
to Emacs or Vi ? Star Trek or Star Wars ? More seriously yes there are
behavior that don't suit everyone. We tend to weight toward newcomers, and
have reasonable safe default.It can be annoying but we expect that advance
users that are annoyed are sufficiently skilled to: 1) figure it out 2) ask
hints at how to do it.

> As a user, I've come across the situation you describe. We're all
> different in this world, but my firs thought was to use the File menu to
> create a copy, work on that, then incorporate any changes into or
> overwrite the notebook.

Thanks that's a good thing possible as well. If you have any other tips,
let us know.

And to everyone if you figure out how to do it from custom JS, or tried the
extension and found it amazing, we'll be at the Docathon next week, it
would be fantastic to summarize some of the tips and tricks that are in
this thread and polish them in a nice pull-request against or docs !

And kudos the awesome often under-advertised work of the folks from
IPython-contrib/Jupyter-contrib, hope they submitted a talk to JupyterCon !

Thanks !
--
Matthias

DG

unread,
Mar 2, 2017, 4:50:30 PM3/2/17
to Project Jupyter
OK. I am just trying to understand how to make Min RK's solution above work. I actually don't care about having a user interface for this setting.

My understanding of his solution was to create a text file with this content:

require(['base/js/namespace', 'base/js/events'], function (IPython, events) {
  events
.on(
"notebook_loaded.Notebook", function () {
   
IPython.notebook.minimum_
autosave_interval = 0; // disable autosave

 
});
});


Call it custom.js, and put into ~/.jupyter/custom
I did this, and it does not seem to work. Note: I am on macOS and using Anaconda.

One thing that is strange: the ~/.jupyter folder is almost empty, it contain only a single file called migrated.

So are the instructions obsolete? Could somebody help make this work?

Thanks,
DG

Matthias Bussonnier

unread,
Mar 2, 2017, 5:05:24 PM3/2/17
to jup...@googlegroups.com
On Thu, Mar 2, 2017 at 1:50 PM, DG <davide....@gmail.com> wrote:

> Call it custom.js, and put into ~/.jupyter/custom
> I did this, and it does not seem to work. Note: I am on macOS and using
> Anaconda.

On macOS it might be in ~/Library/Jupyter/custom

I believe `jupyter --path` can give you where these files can be found.

try to put a "console.log('--- in here ---')" at the top of your
custom.js file, it should print a message in the JS console of your
browser if it is seen. Also your browser may be aggressively caching.
try to "View > Force refresh" the page when trying. You should not
need to restart the server for it to work.

--
M

Simon Biggs

unread,
Mar 3, 2017, 1:29:27 AM3/3/17
to Project Jupyter
Thanks Matthias for all the hard work you and everyone working on Jupyter does.

I just wanted to let you know that my supervisor has been able to gradually become more and more comfortable with programming by using the jupyter notebook interface. For me this is brilliant, I get more and more freedom to program at work, in a way that is very enjoyable, in no small part because you all have created something (and are creating something) that is a pleasure to use for newcomers.

On top of that, someone who in the past avoided programming is having it help them in their work life gradually more and more.

Thank you.

DG

unread,
Mar 3, 2017, 1:44:21 AM3/3/17
to Project Jupyter
OK, there is something in ~/Library/Jupyter, including two folders called nbextensions and runtime. I tried to create a new folder 'custom' and the custom.js file inside it--but it still does not work. 

jupyter --path gives the following output:

config:


    /Users/davide/.jupyter


    /Users/davide/anaconda/etc/jupyter


    /usr/local/etc/jupyter


    /etc/jupyter


data:


    /Users/davide/Library/Jupyter


    /Users/davide/anaconda/share/jupyter


    /usr/local/share/jupyter


    /usr/share/jupyter


runtime:


    /Users/davide/Library/Jupyter/runtime


There four (!!) directories for config, which I am guessing is where the custom folder would go. The first one is the same as above. The second one contains a bunch of json files. The other two do not exist (!). 


Also, I tried to install the extension above. I followed the convoluted steps to install the extensions, then the extensions manager. But this also does not work.

So it's very frustrating....

DG

Thomas Kluyver

unread,
Mar 3, 2017, 5:48:42 AM3/3/17
to Project Jupyter
On 2 March 2017 at 21:50, DG <davide....@gmail.com> wrote:
Call it custom.js, and put into ~/.jupyter/custom
I did this, and it does not seem to work. Note: I am on macOS and using Anaconda.

You're doing the right thing, but I suspect you might be waiting for an event that has already been fired before your code is loaded, so you never see it. Scatter some console.log() calls around the javascript to see what bits are getting run (you can pull up the browser Javascript console to see messages from console.log()).


> One thing that is strange: the ~/.jupyter folder is almost empty, it contain only a single file called migrated.

That's OK - the migrated file is to mark that it's migrated any old config from IPython, though you seemingly didn't have any.

Thomas

DG

unread,
Mar 3, 2017, 12:14:51 PM3/3/17
to Project Jupyter


On Friday, March 3, 2017 at 2:48:42 AM UTC-8, takowl wrote:
On 2 March 2017 at 21:50, DG <davide....@gmail.com> wrote:
Call it custom.js, and put into ~/.jupyter/custom
I did this, and it does not seem to work. Note: I am on macOS and using Anaconda.

You're doing the right thing, but I suspect you might be waiting for an event that has already been fired before your code is loaded, so you never see it. Scatter some console.log() calls around the javascript to see what bits are getting run (you can pull up the browser Javascript console to see messages from console.log()).



@takowl, that's a good suggestion. I did and I do see that the script was loaded. Still trying to figure out whether it's autosaving or not...stay tuned.

DG

unread,
Mar 3, 2017, 12:43:24 PM3/3/17
to Project Jupyter
Well, the script loads, BUT AUTOSAVE IS STILL ON. That's disappointing.

Thomas Kluyver

unread,
Mar 3, 2017, 12:47:23 PM3/3/17
to Project Jupyter
Try moving the bit that sets the interval out of the event handler?

On 3 March 2017 at 17:43, DG <davide....@gmail.com> wrote:
Well, the script loads, BUT AUTOSAVE IS STILL ON. That's disappointing.

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.

DG

unread,
Mar 3, 2017, 12:56:59 PM3/3/17
to Project Jupyter
I am now totally confused. 

Here's a way to check what the autosave interval is:

%%javascript
var nb = Jupyter.notebook;
var interval =  nb.minimum_autosave_interval 
nb.kernel.execute("NB_interval = '" + interval + "'");

This put 10000 into the variable NB_interval. It must be some default vale. 

Then, I tried changing the autosave interval to 0 with:
%%javascript
var nb = Jupyter.notebook;
var interval =  nb.minimum_autosave_interval  = 0;

Previous script confirms NB_interval is not 0.

Well, even now, autosave is still on. WTF?

Matthias Bussonnier

unread,
Mar 3, 2017, 1:02:41 PM3/3/17
to jup...@googlegroups.com
My bad,

You actually have to call the following method:

Jupyter.notebook.set_autosave_interval(int)

The periodic callback that autosave lives on the Javascript VM, and we
need to cancel it, which assigning to minimum_autosave_interval does
not do (as javascript does not have properties in the Python sens)

You should see a quick "Autosave Disabled" in the upper-right corner
when you do so (next to the kernel name).
--
M
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+u...@googlegroups.com.
> To post to this group, send email to jup...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/61fb06a0-5cd7-4c46-a56c-e0c4613b897c%40googlegroups.com.
Screen Shot 2017-03-03 at 10.01.10.png

DG

unread,
Mar 3, 2017, 2:47:09 PM3/3/17
to Project Jupyter
OK, I can confirm that if I execute this code:

%%javascript
Jupyter.notebook.set_autosave_interval(0);

then I do see the "Autosave disabled" message appear. That's a good sign. 

The question is now, how should the custom.js script look like? This is the original one:
console.log("Loading autosave disable script");
require(['base/js/namespace', 'base/js/events'], function (IPython, events) {
  events.on("notebook_loaded.Notebook", function () {
    IPython.notebook.minimum_autosave_interval = 0; // disable autosave

  });
});

At the very minimum, IPython needs to be changed to Jupyter. Also, it's not minimum_autosave_interval, it's autosave_interval. So I tried this:
console.log("Loading autosave disable script");
require(['base/js/namespace', 'base/js/events'], function (Jupyter, events) {
  events.on("notebook_loaded.Notebook", function () {
    Jupyter.notebook.autosave_interval = 0; // disable autosave
  });
});

Now when I open a new notebook I do see the "autosave disabled" message popping up. So it seem it's finally working. I need some more time to be sure.
Thanks Matthias and everybody who helped.
Message has been deleted

Seth

unread,
Nov 28, 2017, 2:44:37 PM11/28/17
to Project Jupyter
Hmm, I'm in the same boat as DG. I've created the custom.js file in a (newly made) custom directory under ~/.jupyter. I can confirm that the script is running because I see the "Loading" line in my javascript console. But I still see "Saving every 120s" in the top right corner when I open a notebook.... What am I missing?
Reply all
Reply to author
Forward
0 new messages