Installation using pip
pip install https://github.com/chicham/py2nb.git
Once installed a script name py2nb.py
is added to your PATH. Just type
py2nb.py myscript.py
To generate a myscript.ipynb
readable by jupyter.
py2nb.py myscript.py -o name.ipynb
py2nb.py myscript.py -v 3
To generate a notebook compatible with the version 3 of the ipython API. By default the version 4 is used.
In order to be converted the python source file some comments must be add to the source file.
# <markdowncell>
# My text in
# the markdowncell
# <rawcell>
# A raw cell
# <codecell>
from numpy.random import randint
randint(0, 5, (3, 5))