Create .ipynb file from a .py file with Jupytext, without notebook overwritting

58 Views Asked by At

I work on Jupyter notebooks, but work in a team that requires the associated .py files to better understand the modifications in the code, through GitLab.

To that end, I must only commit the .py file. On their side, when pulling the remote .py file on pycharm, they must create the associated .ipynb copy file, and synchronize them together.

I have creates filewatchers in pycharm so that :

  • when saving the .py file, it modifies the synchronized .ipynb
  • when saving the .ipynb file, it modifies the synchronized .py

However, I meet the following issue:

  • when I save my notebook, the python file overwrites the notebook I have just modified
  • when I save my python file, both files are saved according to the content of the .py file

BUT :

  • when I create a python file from the notebook (and not the notebook from the python file), the filewatchers work as expected

So I concluded:

  • I feel like when creating a notebook from the python file, the jupytext library is not doing what is wanted, because it might be created to do the opposite (?), and so the notebook is overwritten.

May I have explanation on this ?

0

There are 0 best solutions below