Beginning Programming with Python For Dummies
Book image
Explore Book Buy On Amazon
Checkpoints are a Notebook-specific feature that can save Python programmers a huge amount of time and embarrassment when used correctly. A checkpoint is a kind of interim save and source control combined into a single package. What you get is a picture of your application at a specific point in time.

Defining the uses of checkpoints

Unlike many application saves, a checkpoint is an individual entry. Every time you create a checkpoint, you also create a hidden file. This file resides in a special folder of your project folder. You can go back to this specific checkpoint later, if necessary, to turn back the clock of your development efforts. Checkpoint-type saves occur at these times:
  • Automatic: Notebook automatically creates a save for you every 120 seconds by default unless you change this interval using the %autosave magic function.
  • Manual checkpoint save: Generates a separate manually created save file.
All the save options use a single file. Consequently, each save overwrites the previous file. Any save is useful for general backup, ensuring that you have an alternative if an entity damages the original file between occurrences of major events (such as running or closing the application).

The manual checkpoint save helps you create a special kind of save. For example, you might get your application to a stable point at which everything runs, even if the application isn't feature complete. Consequently, you want to create a manual save, a checkpoint, to ensure that you can get back to this point should future edits cause application damage.

Checkpoints can also come in handy at other times. For example, you might add a risky feature to your application and want to protect the application against damage should the addition prove fatal. You use checkpoints whenever you want to be able to go back to a specific point in time during application development. It’s a kind of insurance that works in addition to automatic saves.

Even though Notebook won’t display multiple checkpoints, you can keep multiple checkpoints if desired. Simply rename the existing checkpoint and then create a new one. For example, if you name the existing checkpoint BPPD_04_Comments-checkpoint.ipynb, you might rename it to BPPD_04_Comments-checkpoint1.ipynb before you create a new save. To use an older checkpoint, you must rename it back to the original name of checkpoint.ipynb.

Saving a checkpoint

To save a checkpoint, you choose File → Save and Checkpoint. Notebook automatically saves a copy of the existing notebook in the .ipynb_checkpoints folder using the same name with -checkpoint added. Unless you specifically rename the existing checkpoint, the manual or automatic save will overwrite the existing file. Consequently, all you ever see is a single checkpoint file unless you rename older files manually.

Restoring a checkpoint

To restore a checkpoint, choose the entry found on the File → Revert to Checkpoint menu. This menu makes it appear that you can have more than one checkpoint file, but the menu never has more than one entry in it. The entry does contain the date and time that you created the checkpoint.

About This Article

This article is from the book:

About the book author:

John Paul Mueller is a freelance author and technical editor with more than 107 books and 600 articles to his credit. His subjects range from networking and artificial intelligence to database management and heads-down programming. He also consults and writes certification exams. Visit his website at

This article can be found in the category: