This Engineering Notebook post describes a breakthrough that will radically simply #4117 <https://github.com/leo-editor/leo-editor/issues/4117> support jupytext. As a result of this Aha, I've just renamed this issue. This ENB will be pre-writing for a thorough revision of that issue's first comment.
*Background: syncing files* Work on #4117 has gone smoothly. Nevertheless, one detail keeps complicating the code. How should Leo keep a notebook file, say *x.ipynb*, in sync with its paired jupytext file, *x.py*? *Aha: Don't sync files!!!* Leo should support *@jupytext* nodes. The following will be equivalent: @jupytext x.py @jupytext x.ipynb @jupytext x The file's extension *doesn't matter *because: - When Leo *reads *an @jupytext x node, Leo will use jupytext to *re-create that *node and all its descendants *from x.ipynb*. - When Leo *writes *the @jupytext x node, Leo will use jupytext to *re-create x.ipynb* from the entire @jupytext tree. - When Leo checks for an externally changed .ipynb file, Leo will *re-create* the corresponding @jupytext x node, assuming such a node exists. @jupytext collapses the complexity of all the jupytext-related code: - Leo will *only* read and write .ipynb files. - Within Leo, jupytext will *never *create .py files! - As a result, Jupyter users won't need to use jupytext! *Use cases within Leo* Users can edit @jupytext nodes as usual. They can insert, delete and rearrange nodes. A Leo option might specify whether to treat @jupytext nodes as @clean or @file. However, it's an open question whether Leo's sentinels are tolerable within Jupyter itself. I'll experiment soon. *Summary* @jupytext simplifies everything: - *Only *@jupytext nodes update .ipynb files automatically. - Leo will *only* read and write .ipynb files. - There are no paired files to sync! - There are no syntactically incorrect paired .py files! - Jupyter users don't need to use jupytext! All your questions and comments are welcome. Edward P.S. Writing this ENB has convinced me that @jupytext is the way forward. I would be shocked if @jupytext isn't the best solution for both Leo's users and maintainers. EKR -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/leo-editor/a418e6cd-a1b3-444b-81e1-cad9200c96b0n%40googlegroups.com.
