-
Notifications
You must be signed in to change notification settings - Fork 386
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
Jupytext should refuse to open out of date paired text representations #63
Comments
This can also be an issue if one edits the same notebook from different machines, some might have jupytext installed and some might not. I would suggest you put in the meta data of both the ipynb and text file some hash/version number that would be a more reliable way than just looking at the filesystem filestamp. When the ipynb's version is higher than the textfile's, it should take precedence. (Or maybe there can be some dialog to ask if they should be merged together or not, if this is feasible.) |
Hello @boazbk , yes I agree, we need to find a reliable way to decide whether we can override the As for the action to take when text file timestamp is older than ipynb, I am in favor of refusing to open the paired notebook, with the following message: remove either file, or edit the text file to confirm that it is indeed up to date. |
@cclauss , thanks for your previous contributions. Would you have recommendations on this precise question? Are you aware of any better approach than timestamps? |
I have no knowledge on this topic. Sorry. |
@mwouts I was thinking of cases where for example the notebook is in dropbox or something like that, and was also hoping that it would be possible at least on the ipynb file to update this without user interaction, but I'm not a programmer. |
Notebooks returned by the content manager have a |
@boazbk: well, I think you're right: using timestamps is not perfect. Actually Jupyter itself has a few issues on the subject - a few people report that the warning on overwriting is triggered with no obvious reason. Therefore I plan to
I do think the check is important. Overriding the inputs with an out of date content is not very nice to the user! |
I have implemented the check. Error message tries to be as explicit as possible. For instance:
|
@boazbk , would you mind to try the new version? In order to trigger the message above I expect that you will have to edit (with a text editor) the ipynb file, to make it more recent than the text notebook.
Thanks! |
Will try soon, thanks! |
I use git to version control my .ipynb and .py pairs. Sometimes, I need to use
It's very annoying. Maybe we should save the timestamp and file hash of last sync into the meta data of all paired files, e.g. the
When we open an .ipynb file, it'll check the paired .py's timestamp and file_hash under the |
Hi @allenyllee , this is a very old issue so I won't reopen it, but still I think we can do something for you use case - please see #799. |
Cf. Hari's question on medium: is it safe to uninstall
jupytext
?Obviously uninstalling is safe. But reinstalling after a while may not be. As text representations have priority over ipynb file, the user that has worked on the ipynb version without jupytext will get the out of date version from the text representation, when he decides to reinstall.
To avoid such a situation (which can be solved by: closing the notebook without saving, and deleting the text file), we should check file timestamps, and refuse to load inputs from text when text seems to be out of date compared to the ipynb file.
The text was updated successfully, but these errors were encountered: