New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move kernel code into IPython.kernel #2854
Conversation
Will try to get a look but need to go now. |
FYI travis build is done and passes. Maybe just to be annoying, |
@Carreau I've renamed it make_ipkernel_cmd. I decide to consolidate IPython.lib.kernel and IPython.zmq.entry_point into a single IPython.utils.kernel (IPython.lib.kernel imports from here with a deprecation warning, to avoid breaking apps like vim-ipython). |
@minrk is this consolidation work going to be in this PR? Should I wait to On Mon, Jan 28, 2013 at 3:05 PM, Min RK notifications@github.com wrote:
Brian E. Granger |
it's already done here, go ahead and have a look. It's basically just copy/paste the two files into the new location and updated imports. |
We are doing enough reorganization in this PR, some things I am wondering about...
I think this would provide a clean set of abstractions that better reflect how the code is organized. I know this expands the work for this PR a bit more, but you are much of the way there... Cheers, Brian |
where it always should have been.
Sure, so: (checklist added to top)
anything more than that? |
If most of the things in the kernel utils module are related to launching kernels, then I think that launcher is also a good module name. |
I have also changed a few things in the todo list... |
It is not, but I can split it into two or three files. A minority is directly for launching kernels, the rest is for dealing with connection files (locating them, writing them, etc.), and connecting to kernels (ssh tunnels, etc.). In any case, I think the official API for these should be IPython.kernel, so the specific filename or number of files is not so important. |
I disagree with moving zmq.kernel and zmq.kernelmanager into IPython.kernel. These are 100% zmq-specific. I think only if/when we build zmq-less base classes should they go into IPython.kernel. |
I think splitting utils into a few files would make things easier to find I forgot about what the Kernel object had in it - you are right that it is The reason I thought about moving kernelmanager out of zmq is that it is On Mon, Jan 28, 2013 at 8:35 PM, Min RK notifications@github.com wrote:
Brian E. Granger |
It sounds like your argument is backwards. All the stuff in IPython.zmq is specific to our kernel, and you are suggesting that we create a new module called "IPython.kernel" that has everything but code directly involved in the kernel.
If we move kernelmanager to IPython.kernel, zmq.session will be the only import from IPython.zmq in either the notebook or qtconsole (aside from a couple of classes used to generate default config files). |
I should say - your argument does make sense, in that IPython.zmq contains 'our zmq-based IPython kernel', and these other things like KernelManager might belong somewhere else. I just think 'IPython.kernel' isn't the right name for it, since there is something called the "IPython kernel" and IPython.kernel is strictly code that is not that kernel. There is one point though - if the zmq KernelManager belongs in this new package, but the zmq Kernel lives in IPython.zmq, that would suggest that the inprocess KernelManager and Kernel do not themselves belong together in the same subpackage, right? To my mind, we have subpackages containing an implementation of a Kernel (currently zmq and inprocess), and their unique peers (associated KernelManagers) are also defined adjacently. Things that belong in IPython.kernel should be strictly reusable, which the zmq KernelManager certainly is not - it can only talk to kernels that talk the wire protocol (distinct from the message protocol in general) as implemented in zmq.Session. In this way, IPython.kernel makes sense as the generic kernel-related code, IPython.zmq is zmq-specific kernel-related code, etc. The KernelManager is 100% zmq-specific. If we do build a generic zmq-free base class, then that would belong in IPython.kernel under this scheme. |
- merged IPKernelApp into KernelApp, they are no longer separate classes - embed_kernel moved to its own file - ipkernel now only contains the Kernel class - associated imports updated
I'v re-read, and I just realized that you want both Kernel and KernelManager in IPython.kernel. I think that actually makes sense. If we do end up getting the zmq-dependent functionality out of the base Kernel and KernelManager classes, then we will add the zmq-specific subclasses back to IPython.zmq, and IPython.kernel can be zmq-free. |
quick question: embed_kernel was in zmq.ipkernel, but I gave it its own file. Should that file now be in IPython.kernel or IPython.zmq? I'm leaning towards IPython.kernel. |
I also presume blockingkm should come along too? I don't see a reason why blockingkm would not live adjacent to km. |
I am feeling pretty sick tonight so I am going to bed right now. But maybe On Mon, Jan 28, 2013 at 10:34 PM, Min RK notifications@github.com wrote:
Brian E. Granger |
Queue.get(timeout=None) has stupid uninterruptible behavior, so wait for a week instead.
Feel better! I'm still 50/50 on moving Kernel and KernelManger from zmq to kernel, so I will wait until we chat. Here's the gist, as I see it:
|
Okay, @ellisonbg, I think this is ready for a look. |
""" | ||
) | ||
def _kernel_cmd_changed(self, name, old, new): | ||
print 'kernel cmd changed', new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a debug message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it certainly is. Fixed.
OK I have looked through the code, run the test suite and run all of the main ipython applications. Everything works perfectly. I really like how this turned out and think it is such a huge improvement. The code is much more transparent and logically organized. There may be bug that this PR is introducing, but I think the only way we will find them is by using it. Because of this, I think we should merge this unless you want to get some other eyes on this. |
I think this is ready to go - I would go ahead with the merge. |
Move kernel code into IPython.kernel inprocess Kernel in kernel.inprocess zmq Kernel in kernel.zmq KernelManager stuff and ulities in top-level kernel Main functional change: allow custom kernel Popen command - [x] adds `KernelManager.kernel_cmd` configurable for launching a custom kernel - [x] splits entry_point.base_launch_kernel into two steps: making the launch cmd and launching the subprocess - [x] figure out where the entry_point functions belong, if it should be anywhere else - [x] move IPython.zmq.kernelmanagerabc to IPython.kernel.kernelmanagerabc - [x] move IPython.lib.kernel/IPython/zmq.entry_point to IPython.kernel.launcher / connect - [x] move zmq.ipkernelapp.IPKernelApp to zmq.kernelapp (I'll look at merging the classes, and see if it makes - [x] move IPython.zmq to IPython.kernel.zmq - [x] move IPython.inprocess to IPython.kernel.inprocess - [x] move embed_kernel from zmq.ipkernelapp to zmq.embed - [x] move MultiKernelManager to IPython.kernel.multikernelmanager. - [x] move IPython.zmq.blockingkernelmanager to IPython.kernel.blockingkernelmanager. - [x] move IPython.zmq.kernelmanager to IPython.kernel.kernelmanager. - [x] move IPython.ipkernel.Kernel to IPython.kernel.kernel.
A few changes left out from PR ipython#2854 prevented pager or set_next_input (%load) from working in the notebook.
Move kernel code into IPython.kernel inprocess Kernel in kernel.inprocess zmq Kernel in kernel.zmq KernelManager stuff and ulities in top-level kernel Main functional change: allow custom kernel Popen command - [x] adds `KernelManager.kernel_cmd` configurable for launching a custom kernel - [x] splits entry_point.base_launch_kernel into two steps: making the launch cmd and launching the subprocess - [x] figure out where the entry_point functions belong, if it should be anywhere else - [x] move IPython.zmq.kernelmanagerabc to IPython.kernel.kernelmanagerabc - [x] move IPython.lib.kernel/IPython/zmq.entry_point to IPython.kernel.launcher / connect - [x] move zmq.ipkernelapp.IPKernelApp to zmq.kernelapp (I'll look at merging the classes, and see if it makes - [x] move IPython.zmq to IPython.kernel.zmq - [x] move IPython.inprocess to IPython.kernel.inprocess - [x] move embed_kernel from zmq.ipkernelapp to zmq.embed - [x] move MultiKernelManager to IPython.kernel.multikernelmanager. - [x] move IPython.zmq.blockingkernelmanager to IPython.kernel.blockingkernelmanager. - [x] move IPython.zmq.kernelmanager to IPython.kernel.kernelmanager. - [x] move IPython.ipkernel.Kernel to IPython.kernel.kernel.
A few changes left out from PR ipython#2854 prevented pager or set_next_input (%load) from working in the notebook.
inprocess Kernel in kernel.inprocess
zmq Kernel in kernel.zmq
KernelManager stuff in top-level kernel
Main functional change: allow custom kernel Popen command
reissue of #2853, because it didn't seem to want to track the right commits
KernelManager.kernel_cmd
configurable for launching a custom kernelIf you use my iruby branch (every other one I found had failures in the msg spec / session), you can run ruby kernels with qtconsole/console/notebook with:
supersedes #2643