Skip to content

Writes to .ipynb file even when it is newer (being actively edited) #12

@td-anne

Description

@td-anne

I am working with the .ipynb file (I don't have the paired .py file open and am not editing it) and from time to time the .ipynb file will be rewritten by jupytext. Mostly this results in the .ipynb editing window dropping out of editing the cell I am editing, sometimes scrolling to somewhere radically different in the notebook; sometimes it somehow interrupts the kernel executing the current cell, or at least swallows the cell's output; occasionally I get a message telling me that the .ipynb file is newer than VSCode thinks it should be and I have to manually tell it that it's safe to overwrite it with what I am editing.

I have VSCode autosave on pauses in typing, so I think this happens when VSCode saves the .ipynb file; definitely I see it happen (sometimes) when I manually hit "save". I also have ruff formatting the file on save.

My guess would be that the .ipynb file is being saved, then jupytext runs and updates the .py file; but then the .py file appears to be newer, and jupytext runs again, copying the content of the .py file back into the .ipynb file. File-wise, this is a safe round-trip, so it does not damage the contents. Unfortunately VSCode correctly detects that the .ipynb file has been "modified" and reloads it; this reload affects active editing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions