132

Besides the original Jupyter Notebook file (.ipynb file), sometimes I get a checkpoint .ipynb file which seems to be directly linked to the original .ipynb file.

What's the purpose of these checkpoint files?

And what causes them to be generated (sometimes I get this sort of checkpoint file, and sometimes I don't)?

Nino Filiu
  • 16,660
  • 11
  • 54
  • 84
Alex
  • 3,958
  • 4
  • 17
  • 24

1 Answers1

138

Jupyter creates a checkpoint file every single time you create an .ipynb file, and then it updates the checkpoint file every single time you manually save your progress for the initial .ipynb.

A manual save is what's done when the file is saved by clicking the Save and Checkpoint button:

img

Auto-saving, on the other hand, updates only the initial .ipynb file, not the checkpoint file.

When you revert from the initial .ipynb file to a previously saved checkpoint by using the Revert to Checkpoint button, the checkpoint file is what gets accessed and opened inside Jupyter.

img2

As a side note, the checkpoint file is located within a hidden folder named .ipynb_checkpoints. This folder is located within the same folder as the initial .ipynb file.

Alex
  • 3,958
  • 4
  • 17
  • 24
  • 11
    So this is essentially a simplistic version control? Very cool. – user1323995 Apr 21 '18 at 18:19
  • 16
    Yea, right, but as you said it, a *simplistic* one -- it only saves the last version of your work. And once you revert to the last version, you can't revert back to an even older version. – Alex Apr 22 '18 at 04:13
  • 3
    And I don't see any GUI way to get a diff, or an easy way to selectively pull content from the checkpoint. – nealmcb Jun 20 '18 at 01:42
  • 3
    For some thoughts about diffing, see `nbdime` and [Displaying Differences in Jupyter Notebooks – nbdime / nbdiff](https://blog.ouseful.info/2017/01/27/displaying-differences-in-jupyter-notebooks-nbdime-nbdiff/) and [Pondering a Jupyter Notebook “Diff”er Extension and Its Use as a Marking Tool – OUseful.Info, the blog…](https://blog.ouseful.info/2017/06/02/pondering-a-jupyter-notebook-differ-extension-and-its-use-as-a-marking-tool/) – nealmcb Dec 04 '18 at 20:16
  • 5
    Not version control, but a simple backup. – qwr Feb 15 '21 at 00:44