Skip to content

Comments

Implement get_checkpoint to allow content retrieval without restoration#1592

Open
mariam851 wants to merge 2 commits intojupyter-server:mainfrom
mariam851:fix-retrieval-3011
Open

Implement get_checkpoint to allow content retrieval without restoration#1592
mariam851 wants to merge 2 commits intojupyter-server:mainfrom
mariam851:fix-retrieval-3011

Conversation

@mariam851
Copy link

The Problem:
Currently, FileCheckpoints and AsyncFileCheckpoints do not implement the get_checkpoint method. This makes it impossible to retrieve the content of a specific checkpoint without performing a full restoration, which can lead to data loss of the current unsaved work.

The Solution:
This PR implements the get_checkpoint method in both synchronous and asynchronous classes.

Key Changes:
Direct File Access: Used internal _read_file and _read_notebook methods to read checkpoint data directly from the filesystem.

Path Handling: Implemented proper OS path to API path mapping to ensure compatibility across different operating systems, especially Windows.

Bypassing Hidden Directory Restrictions: By reading files directly, we bypass the ContentsManager 404 errors that occur when trying to access the hidden .ipynb_checkpoints directory via the standard API.

Testing:
I have verified the implementation using pytest and manual testing:

Synchronous test: Successfully retrieved versioned content of .txt files.

Asynchronous test: Successfully retrieved content using AsyncFileCheckpoints.

Windows Compatibility: Confirmed that path separators are handled correctly.

@minrk
Copy link
Contributor

minrk commented Feb 9, 2026

Thanks for the PR! Since you have tested this with pytest, can you make sure to include tests for these methods in the PR?

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

Successfully merging this pull request may close these issues.

2 participants