To save a jupyter script as an executable .py script you can use the
nbconvert command in terminal:
$ jupyter nbconvert --to script [NOTEBOOK_NAME].ipynb
Make sure to either
cd into the directory where the ipynb file is located or to paste the complete path of the file. But even better is to call the command directly in a jupyter notebook by prepending
!, which will run bash code inside any jupyter script:
!jupyter nbconvert --to script [NOTEBOOK_NAME].ipynb
In this way you can save your .ipynb file to .py file in an easy and fast way and only when you need it, such as when pushing a commit to github, saving time compared to when using auto convert.