Is it possible to convert a .nb notebook to a package and then back again to a .nb?

I know that i can achieve something similar with save as...

With this option, I am ok with the output being lost in the conversion. But the problem is that also the Cell headers / groups are lost and then navigating the .nb versions becomes difficult.

My goal is to have a script version of a notebook where it is easier to fix code and edit and then go back to the notebook where it is easier to interact.

  • 1
    $\begingroup$ I don't think you are really asking about packages. I would describe it as conversion between notebook and plain text format. It would certainly be nice to be able to do something of this sort. $\endgroup$
    – mikado
    Commented Apr 30 at 14:01
  • $\begingroup$ yeah!. plain text that respects the .m syntax. For example in the python ecosystem there is jupytext that does this conversion between notebooks and scripts incredible well and is super useful. $\endgroup$
    – elbOlita
    Commented May 1 at 15:05


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.