gregsexton / ob-ipython

org-babel integration with Jupyter for evaluation of (Python by default) code blocks
738 stars 108 forks source link

Exporting to ipynb format #41

Open alxempirical opened 8 years ago

alxempirical commented 8 years ago

It would be super-handy to be able to round-trip an ipython org notebook to the .ipynb format used by ipython notebook.

gregsexton commented 8 years ago

This could be useful for working with others I guess. The main issue is that Org is much more powerful than the ipynb format. This will likely be very lossy.

singletS commented 8 years ago

Org-mode Jupyter Backend looks to offer a start. Not round-trip, but at least org-mode could generate ipynbs. And lossyness is in the right direction if org file is considered the "source" document.

xelibrion commented 7 years ago

There's an awesome script by @jkitchin http://kitchingroup.cheme.cmu.edu/blog/2017/01/21/Exporting-org-mode-to-Jupyter-notebooks/ Might make sense to join the efforts.

julienchastang commented 7 years ago

This looks interesting, but what I have found is when converting an org-mode file to ipynb, you have to have the human in the loop at some point. In other words, there is unavoidable manual labor. So here is the workflow I’ve settled on:

Because of ein-mode key bindings, the last step actually goes really quickly. ein-mode is a bit of a pain to get set up right, but once you have it working, it’s a dream.

jkitchin commented 7 years ago

I don't have that problem. What manual labor is required? So far my exporter turns org files into the notebooks I would expect with no intervention from me. It puts code blocks into code cells including results and everything else to markdown cells. It even manages inline images and HTML and Latex cells.

It is not an exporter in the usual sense. I parse the org file a little differently to split it into markdown cells and code cells. So the headline hierarchy is not preserved in the cells except through the markdown headings.

On Fri, Feb 10, 2017 at 4:10 PM Julien Chastang notifications@github.com wrote:

This looks interesting, but what I have found is when converting an org-mode file to ipynb, you have to have the human in the loop at some point. In other words, there is unavoidable manual labor. So here is the workflow I’ve settled on:

  • Write the org-mode file
  • Export the org buffer as markdown
  • Copy/paste the markdown into one Jupyter cell via ein-mode
  • Use ein-mode to split the cells and decide if they are code or markdown

Because of ein-mode key bindings, the last step actually goes really quickly. ein-mode is a bit of a pain to get set up right, but once you have it working, it’s a dream.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gregsexton/ob-ipython/issues/41#issuecomment-279066509, or mute the thread https://github.com/notifications/unsubscribe-auth/ABiRVrhBjEoImH3_xTinwn4273QvPCMnks5rbNIogaJpZM4HIG8R .

-- John


Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu