neopyter icon indicating copy to clipboard operation
neopyter copied to clipboard

Question: Going from ipynb to .ju.py

Open thecontinium opened this issue 1 year ago • 3 comments

Hi @AbaoFromCUG

Thanks for putting this together.

I'm interested how you work with current notebook files that you want to edit and keep in sync.

  • I used jupytext to convert from ipynb to a py file - Is there a way of directly creating a .ju.py from a .ipynb within neopyter ?
  • how do you keep the ipynb and ju.py in sync ?
  • have you considered integrating jupytext in some fashion ?

Thanks

thecontinium avatar Jul 24 '24 15:07 thecontinium

  • In my practices, .ju.py files as souce file, and .ipynb as temporary file, my version control system only track .ju.py file.
  • Current sync mode only support one-way synchronization, which means that .ju.py=> .ipynb, support two-way synchronization is complex, cann't support in a short term
  • jupytext use a “virtual notebook” in Jupyter lab, I think it is a better design than Neopyter, because Neopyter require a real .ipynb file. I will support it later.

``

This is my work flow

  1. prepare work
    • start jupyter lab via jupyter lab command and open in browser, different jupyter lab port identify different project
    • start neovim in terminal, write neopyter's config in .neoconf.json , see https://github.com/SUSTech-data/neopyter/blob/master/.neoconf.json
    • Notice: the current work directories of neopyter and JupyterLab could be different, because JupyterLab may run in server in my case
  2. new .ju.py
    • create same name .ipynb in jupyterlab side
    • create same name .ju.py in neovim
    • Start edit
  3. open .ju.py
    • if there is a same name .ipynb, which will be opened in jupyterlab automatically
    • if there is not the same name notebook, I will execute :Neopyter sync current to force sync with current opened notebook (In temporary use case)

Currently, .ipynb is temporary file, should only be used to preview/execute

AbaoFromCUG avatar Jul 25 '24 14:07 AbaoFromCUG

Hi, thanks for his plugin. I'd also love a feature that allows me to use Neopyter to work on an existing Jupyter notebook, that could be really useful.

Examples:

  • collaborate on (version controlled) notebooks with colleagues(!!)
  • use nvim+neopyter to edit my already existing or other's notebooks

dajuno avatar Feb 25 '25 09:02 dajuno

  • In my practices, .ju.py files as souce file, and .ipynb as temporary file, my version control system only track .ju.py file.

    • Current sync mode only support one-way synchronization, which means that .ju.py=> .ipynb, support two-way synchronization is complex, cann't support in a short term

    • jupytext use a “virtual notebook” in Jupyter lab, I think it is a better design than Neopyter, because Neopyter require a real .ipynb file. I will support it later.

``

This is my work flow

1. prepare work
   
   * start jupyter lab via `jupyter lab` command and open in browser, different jupyter lab port identify different project
   * start neovim in terminal, write neopyter's config in  `.neoconf.json` , see https://github.com/SUSTech-data/neopyter/blob/master/.neoconf.json
   * _Notice_: the current work directories of neopyter and JupyterLab could be different, because JupyterLab may run in server in my case

2. new `.ju.py`
   
   * create same name `.ipynb` in jupyterlab side
   * create same name `.ju.py` in neovim
   * Start edit

3. open `.ju.py`
   
   * if there is a same name `.ipynb`, which will be opened in jupyterlab automatically
   * if there is not the same name notebook, I will execute `:Neopyter sync current` to force sync with current opened notebook (In temporary use case)

Currently, .ipynb is temporary file, should only be used to preview/execute

I think this should be stated somewhere in README.md, cause I had issues running the plugin for the first time.

This part with .neoconf.json especially.

IlyaMaksheev avatar Jul 24 '25 10:07 IlyaMaksheev