You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WARNING it might not work with recent versions of Jupyter, traitlets etc. Use at your own risk, this was not updated since 2017. 🔧 Custom Jupyter 📓 NBConvert Exporter for the OCaml language 🐫
Check that you use pip2 or pip3 whether you installed Jupyter for Python 2 or Python 3. (You can of course install Jupyter-NBConvert-OCaml for both if you prefer!)
Use it
$ jupyter nbconvert --to ocaml A_Jupyter_notebook_with_OCaml_kernel.ipynb
$ ls A_Jupyter_notebook_with_OCaml_kernel.ml
...
$ ocaml A_Jupyter_notebook_with_OCaml_kernel.ml # it works and comments are kept
...
To test it locally (in this folder), use this Makefile:
$ make convert_demo_ocaml_local
$ head -n7 demo_notebook_ocaml.ml
(*
This OCaml script was exported from a Jupyter notebook
using an open-source software (under the MIT License) written by @Naereen
from https://github.com/Naereen/Jupyter-NBConvert-OCaml
This software is still in development, please notify me of a bug at
https://github.com/Naereen/Jupyter-NBConvert-OCaml/issues/new if you find one
*)
...
This first OCaml file is the result of jupyter-nbconvert --to script, the default conversion, which removes all comments,
And this second OCaml file is the result of jupyter-nbconvert --to ocaml, our home-made conversion, which removes keep all comments and adds a small header.
WARNING it might not work with recent versions of Jupyter, traitlets etc. Use at your own risk, this was not updated since 2017. 🔧 Custom Jupyter 📓 NBConvert Exporter for the OCaml language 🐫