gregsexton / ob-ipython

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

change kernel and REPL naming conventions #155

Open lwoloszy opened 6 years ago

lwoloszy commented 6 years ago

This PR is probably not yet ready to merge, but I'm interested in hearing if this is the direction you want to go. The main purpose of this code change is to try and unify naming conventions that make explicit the various kernels and sessions that can be spawned through Jupyter. I was experiencing some name clashes between the different kernels and sessions and so this PR attempts to eliminate them (I think) while making everyone's workflow backwards compatible (I think). The most noticeable change is that now each kernel/session started has a name like "\<language>-\<session>" so that, for instance an already running default python session won't preclude starting up a default R session. This change required having every source block contain a :kernel entry, but a default header value of "python" means people used to not specifying it won't have to worry about it. The REPLs adopt a similar naming convention of "Jupyter:\<language>:\<session>. The goal with this particular change is to have a future PR unambiguously connect the src edit buffers with their underlying processes.

The one change that would require altering documentation is src blocks using the jupyter-X magic will now need a :session argument. Also, when jupyter-X is specified as the language but a :kernel argument is explicitly provided, the custom :kernel entry overrides what the jupyter-X magic had done (but I think that's how it is now).

To see if everything was working as I expected it to, I tried out as many permutations of starting and stopping different kernels as I could, including ones started outside of emacs, but I'm sure there's something I overlooked.

Let me know what you think.