The merged class is `jupyter-kernel-process`.
The `jupyter-command-kernel` class existed to launch kernels using the
`jupyter kernel` shell command. This was done to support launching
kernels on remote systems via TRAMP. The work of generating a
connection info. file was offloaded to that command since it can find
out a set of open ports more reliably on a remote system than Emacs
can.
The only difference between the two classes was that the connection
info. was generated manually for a `jupyter-spec-kernel`, so now the
`jupyter kernel` command is relied on in that case too (via
`jupyter-session-with-random-ports` from
8ad90b887a4afa161d907056ae44db5b119dbc5d).
* jupyter-kernel-process-manager.el
(jupyter-env, jupyter-kernelspec): Require.
(jupyter--after-kernel-process-ready): Remove.
(jupyter--start-kernel-process): New function.
(jupyter-start-kernel)
[jupyter-kernel-process]: Use it, set the SESSION slot of a kernel
before doing so.
(jupyter-command-kernel, jupyter-spec-kernel): Remove. Also remove all
related methods.
(jupyter-start-new-kernel): Use `jupyer--kernel-process` to replace
calls to the removed classes.
* test/jupyter-test.el
(jupyter-kernel-lifetime)
(jupyter-command-kernel): Replace references to removed classes with
`jupyter--kernel-process`
* jupyter-channel-ioloop-comm.el
(jupyter-channel-ioloop-comm): Remove it from the super-class list.
Add a `hb` slot to compensate.
(jupyter-hb-beating-p, jupyter-hb-pause)
(jupyter-hb-unpause): Relocated from...
* jupyter-comm-layer.el: ...here.
* jupyter-client.el (jupyter-hb-beating-p, jupyter-hb-pause)
(jupyter-hb-unpause): Check for a `hb` slot instead of it.
* jupyter-comm-layer.el
(jupyter-comm-initialize): Remove default method. This is in
preparation for moving over to classless communication.
* jupyter-channel-ioloop-comm (jupyter-connection): Require.
(jupyter--proxy-channel): New type.
(jupyter--make-channel-group, jupyter--channel-alive-p)
(jupyter--start-channel, jupyter--stop-channel)
(make-jupyter-async-connection): New functions.
(jupyter-channel-ioloop-comm): Remove `ioloop-class` slot, update all
callers. Remove `channels` slot, update all setters and
references. Add `conn` slot which holds a `jupyter-connection`.
(jupyter-comm-initialize): Initialize the `conn` slot to the
connection returned by `make-jupyter-async-connection`.
(jupyter-comm-start, jupyter-comm-stop)
(jupyter-comm-alive-p, jupyter-comm-id, jupyter-channel-alive-p)
(jupyter-stop-channel, jupyter-start-channel): Replace the body of these
functions with their equivalents in `conn`.
* jupyter-kernel-process-manager.el
(jupyter-make-client): Update `jupyter-channel-ioloop-comm` call.
* jupyter-repl.el:
(jupyter-connect-repl): Ditto.
* test/test-helper.el
(initialize-instance) [jupyter-echo-client]: Ditto. Replace setting of
`channel` slot with setting the `conn` clot.
This file holds the `jupyter-connection` type which is an intermediate
successor of `jupyter-comm-layer` on the way towards more functional
kernel I/O.
The new files added in this commit will eventually replace the manager
and kernel classes and favor struct types to represent kernels instead
of classes. A kernel manager was a concept ripped from the
jupyter/jupyter_client reference implementation.
In Emacs the concept makes the client implementation more complicated
and is replaced by functions that manage the lifetime of a kernel:
`jupyter-launch`, `jupyter-shutdown`, and `jupyter-interrupt`.
* jupyter-kernel-manager.el
* jupyter-kernel-process-manager.el
* jupyter-server.el
* test/jupyter-server-test.el
* test/test-helper.el: Make `jupyter-kernel`, `jupyter-server-kernel`,
and `jupyter-kernel-process` private classes. The new files below
use the public names, but as structs now.
* jupyter-kernel.el
* jupyter-kernel-process.el
* jupyter-server-kernel.el: New files.
This is in preparation for merging `jupyter-command-kernel` and
`jupyter-spec-kernel` into just the `jupyter-kernel-process` class.
* jupyter-env.el
(jupyer-session-with-random-ports): New function.
* jupyter-kernelspec.el
(jupyter-expand-environment-variables)
(jupyter-process-environment)
(jupyter-kernel-argv): New functions.
* test/jupyter-test.el
(jupyer-session-with-random-ports)
(jupyter-expand-environment-variables)
(jupyter-process-environment)
(jupyter-kernel-argv): New tests.
* jupyter-kernel-manager.el (jupyter-kernel): Set `spec` slot type to
`jupyter-kernelspec`.
(jupyter-kernel-name):
* jupyter-kernel-process-manager.el: Update all accessors.
* jupyter-kernelspec.el: Add `jupyter-kernelspec` struct type.
* jupyter-repl.el:
* jupyter-server.el:
* ob-jupyter.el:
* test/test-helper.el: Update all kernelspec using functions to use
the new type.
`(byte-compile #'cons)` will return `t` which is not a function.
Passing in the `subr` to `byte-compile` will just return the `subr` so
everything works out OK. This is an attempt at fixing issues like
nnicandro/emacs-zmq#32.
Previously it was hard to step through the code whenever messages were
coming in live from a kernel due to the asynchronous nature of
handling process output in Emacs.
`default-directory` is already set according to :dir when executing a
source block. This prevents `org-babel-expand-body:jupyter` from
attempting to re-expand the value of the :dir header argument.
See #302.
* ob-jupyter.el
(org-babel-jupyter-initiate-session-by-key): Get rid of unnecessary
variable.
(org-babel-jupyter-cleanup-file-links): result-pos -> pos, link-path
-> path, link-dir -> dir. Add resource-dir variable to avoid
calculating the same thing in a loop.
(org-babel-execute:jupyter): kernel-lang -> lang
There was an implementation of `jupyter-start-channels` for a
`jupyter-kernel-process-manager` due to the manager being able to send messages
to the kernel via a kernel's control channel. The channel currently serves as
an implementation detail of the manager class, don't allow its status to be
controlled outside of the manager class by removing the implementation.
In addition, remove the `jupyter-stop-channels` implementation since
it is no longer needed.
* jupyter-kernel-manager.el (jupyter-start-kernel): Remove call to
`jupyter-start-channels` on MANAGER. This should not have been done in the
first place since only `jupyter-kernel-process-manager` implemented that
method, as explained. Also remove the `jupyter-kernel-alive-p` call, this is
already done in an :around method of `jupyter-kernel-alive-p`, see
`jupyter-kernel-lifetime`.
* jupyter-kernel-process-manager.el
(jupyter-start-channels, jupyter-stop-channels)
[jupyter-kernel-process-manager]: Remove. For `jupyter-stop-channels`, expand
body at call site.
(jupyter-start-kernel) [jupyter-kernel-process-manager]: Start the control
channel as a final step.
(jupyter-shutdown-kernel, jupyter-interrupt-kernel): Remove
`jupyter-start-channels` call.