The following changes are made:
jupyter--run-handler-p -> jupyter--request-allows-handler-p
jupyter--handler-dispatch -> jupyter--run-handler
* jupyter-client.el: Do it.
* test/jupyter-test.el: Do it.
* .travis.yml: Add setup for testing SSH components.
* jupyter-base.el (jupyter-tunnel-connection): Document behavior more
completely. Refactor for readability. Ensure that the :ip field of the
returned property list is set to 127.0.0.1 since it represents the connection
info of the remote system but with local ports and should not have a remote
IP address.
* test/jupyter-test.el (jupyter-tunnel-connection): New test.
* test/test-helper.el (jupyter-test-with-kernel): New macro.
Converting to lowercase was done arbitrarily. So that one could write
`(jupyter-lang wolfram-language)` instead of
`(jupyter-lang Wolfram-Language)`.
fixes#241
* CHANGELOG.org: Add note.
* README.org: Update relevant sections.
* jupyter-base.el (jupyter-canonicalize-language-string): Do it.
* ob-jupyter.el (org-babel-jupyter-aliases-from-kernelspecs):
The test for #219 isn't really testing the root cause of the bug, only a
symptom. And it doesn't catch anything on Emacs < 27.
* test/jupyter-test.el (jupyter-repl-issue-219): Skip on Emacs < 27
* jupyter-server.el (jupyter-ioloop, jupyter-server-ioloop): Remove requires.
(jupyter-server): Don't subclass `jupyter-ioloop-comm`.
(jupyter-server--connect-channels, jupyter-server--refresh-comm): Only do
something when the SERVER argument is a `jupyter-comm-layer`, i.e. a
`jupyter-server-ioloop-comm`. We don't check for that class directly since we
would end up requiring ZMQ.
(jupyter-comm-start) [jupyter-server-kernel-manager]: Use the right subclass of
`jupyter-server-abstract-kcomm` depending on if the `jupyter-server` object is
using ZMQ for communication.
(jupyter-server-make-instance): New function. Returns a `jupyter-server`
instance (a `jupyter-server-ioloop-comm`) that uses ZMQ if
`jupyter-server-use-zmq` is non-nil, and a plain old `jupyter-server` instance
otherwise.
(jupyter-current-server): `jupyter-server` -> `jupyter-server-make-instance`.
* ob-jupyter.el (org-babel-jupyter--server-repl): `jupyter-server` ->
`jupyter-server-make-instance`.
* test/test-helper.el (jupyter-test-with-notebook): `jupyter-server` ->
`jupyter-server-make-instance`.
* test/jupyter-test.el: Move all zmq related tests (and code) to
`test/jupyter-zmq-test.el`, add a `zmq` tag to the tests.
* test/test-helper.el (zmq, jupyter-zmq-channel-ioloop)
(jupyter-zmq-channel-ioloop-comm): Remove requires.
(jupyter-test-ioloop-eval-event, jupyter-test-channel-ioloop)
(initialize-instance) [jupyter-echo-client]: Remove uses of ZMQ by using
a `jupyter-mock-comm-layer` for the `kcomm` slot.
(jupyter-test-zmq-sockets): Move to `test/jupyter-zmq-test.el` along with all
related code.
* test/jupyter-zmq-test.el: Add tests moved from `test/jupyter-test.el` and all
related code.
* test/jupyter-server-test.el (jupyter-server): Replace test with one that
takes into account a `jupyter-server`s changed implementation. Before, in
addition to talking to a kernel via the REST API, it managed a set of websocket
connections in a separate process. Now, those websocket connections live in
the current Emacs process.
Ensure that `jupyter-test-with-notebook` uses a `jupyter-server` object by
let binding `jupyter-server-use-zmq` around its call.
(jupyter-server-ioloop-comm): New test with the same body as `jupyter-server`
had before this commit. Skip the test unless `jupyter-server-use-zmq` is
non-nil. Rename `jupyter-server-kernel-comm` to
`jupyter-server-ioloop-kernel-comm`.
The following changes are made:
`jupyter-initialize-connection` -> `jupyter-comm-initialize`
`jupyter-connect-client` -> `jupyter-comm-add-handler`
`jupyter-disconnect-client` -> `jupyter-comm-remove-handler`
`jupyter-comm-client-loop` -> `jupyter-comm-handler-loop`
* README.org: Do it.
* jupyter-channel-ioloop-comm: Do it.
* jupyter-client.el: Do it.
* jupyter-comm-layer.el: Do it.
(jupyter-comm-layer): Rename `clients` slot to `handlers`. Update all uses.
* jupyter-kernel-process-manager.el: Do it.
* jupyter-repl.el: Do it.
* jupyter-server.el: Do it.
* jupyter-zmq-channel-comm.el: Do it.
* test/jupyter-server-test.el: Do it.
* test/jupyter-test.el: Do it.
* README.org: Add notes on behavior when a kernel's language name has spaces
and uppercase characters.
* jupyter-base.el (jupyter-canonicalize-language-string): New function.
* jupyter-client.el (jupyter-kernel-info): Use it.
* jupyter-kernelspec.el (jupyter-available-kernelspecs): Use it.
* ob-jupyter.el (org-babel-jupyter-aliases-from-kernelspecs): Use it.
* test/jupyter-test.el (jupyter-canonicalize-language-string): New test.
Since we are using keyword to represent channels on the client level, use a
plist of channels on the comm layer level instead of channel slots. This allows
us to remove `jupyter-comm-channel` and simplify the relevant code somewhat.
So as to further generalize and separate out the abstract kernel manager class
from its various implementations.
* jupyter-kernel-manager.el (jupyter-meta-kernel): Fix documentation.
(jupyter-kernel-process, jupyter-command-kernel, jupyter-spec-kernel):
Move related functions and methods to `jupyter-kernel-process-manager.el`
(jupyter-kernel-manager-base): Remove class.
(jupyter-kernel-manager): Re-purpose class as the base class of all kernel
managers. The class corresponding to the old functionality is now named
`jupyter-kernel-process-manager`. Move all related functions and methods for
`jupyter-kernel-process-manager` to `jupyter-kernel-process-manager.el`.
* jupyter-kernel-process-manager.el: New file.
* jupyter-repl.el: Require `jupyter-kernel-process-manager` instead of
`jupyter-kernel-manager`.
* jupyter-server.el (jupyter-server-kernel-manager): Inherit from
`jupyter-kernel-manager` instead of `jupyter-kernel-manager-base`.
* test/jupyter-test.el (jupyter-kernel-lifetime)
(jupyter-command-kernel): Use `jupyter-kernel-process-manager` instead of
`jupyter-kernel-manager`.
* test/test-helper.el: Require `jupyter-kernel-process-manager` instead of
`jupyter-kernel-manager`.
See #161
* jupyter-rest-api.el (jupyter-api--delete-cookie):
(jupyter-api-delete-cookies): New functions.
* jupyter-server.el (jupyter-gc-servers): Do it.
* test/jupyter-server-test.el (jupyter-api-delete-cookies): New test.
* jupyter-rest-api.el: Ensure strings are encoded before making HTTP request.
(jupyter-api-http-request): Encode JSON as utf-8.
(jupyter-api-xsrf-header-from-cookies): Ensure header isn't multibyte.
(jupyter-api-authenticate): For the token method, ensure token isn't multibyte.
(jupyter-api-copy-file): Encode string before encoding to base64 for binary content.
(jupyter-api-read-file-content): Decode content as utf-8 when necessary.
* jupyter-tramp.el
(jupyter-tramp-write-region): Ensure only `utf-8` or `binary` coding systems
are used since Jupyter only supports those.
* test/jupyter-tramp-test.el: Update for above changes.
* jupyter-rest-api.el (jupyter-api-content-buffer): New function.
(jupyter-api-insert-model-content): Use it.
* jupyter-tramp.el (jupyter-tramp-file-local-copy): Use it.
* Start notebook on-demand during tests
* Do cleanup of sockets/processes when killing Emacs
* This should work around intermittent core dumps on Travis due to epoll
reconnect attempts.
* Simplify tests by creating and using setup/teardown macros
* jupyter-rest-api.el (jupyter-api-url): Remove.
(jupyter-api--request): Remove. Work moved into `jupyter-api-request`.
(jupyter-api--url-request): Rename to `jupyter-api-url-request`.
Update all callers.
(jupyter-api-add-websocket-headers)
(jupyter-api-construct-endpoint): New functions.
(jupyter-api-request): Use them.
Don't assume "api" prefixes endpoint, update all callers.
(jupyter-api-get-file-model)
(jupyter-api-get-kernel-ws):
Update to account for how query parameters are
passed in `jupyter-api-request`.
* jupyter-server-test: Update tests for changes to `jupyter-api-request`.
(jupyter-api-add-websocket-headers)
(jupyter-api-construct-endpoint): New tests.
squash! jupyter-api-request: Refactor
* jupyter-org-client.el (jupyter-org-request-at-point): Do it.
(org-babel-jupyter-src-block-session): New declare.
* ob-jupyter.el (org-babel-jupyter-session-clients): Add doc about keys.
* test/jupyter-test.el (jupyter-org-request-at-point): New test.