Commit graph

40 commits

Author SHA1 Message Date
Nathaniel Nicandro
1f0612eb93 Remove unused functions
* jupyter-kernelspec.el (jupyter-read-kernelspec)
(jupyter-kernelspecs-for-mode): Do it.
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
403c70c83c Bump version 2020-04-07 15:13:51 -05:00
conao3
fb8c2c75fd two spaces after a period 2020-03-12 18:20:15 -05:00
conao3
1546a72f57 clean header 2020-03-10 23:39:35 -05:00
Nathaniel Nicandro
c5fd3edc85 jupyter-available-kernelspecs: Clarify documentation 2019-09-12 17:24:54 -05:00
Nathaniel Nicandro
67831c08fa Support Jupyter kernel servers
* jupyter-client.el (jupyter-initialize-connection): Elevate NOTE to FIXME.
(jupyter-kernel-info): Extend timeout.

* jupyter-kernel-manager.el (jupyter-shutdown-kernel):
(jupyter-interrupt-kernel): Allow any number of arguments.

* jupyter-kernelspec.el (jupyter-find-kernelspecs): Optionally allow specs.

* jupyter-messages.el (jupyter-encode-raw-message): New function.

* jupyter-rest-api.el (jupyter-api-auth-headers): New function.

* jupyter-server-ioloop.el: New file.

* jupyter-server.el: New file.

* test/jupyter-test.el (jupyter-server):
(jupyter-server-kernel-manager):
(jupyter-server-start-new-kernel): New tests.
2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
6650dd3588 Bump version 2019-07-24 16:03:22 -05:00
Nathaniel Nicandro
fb0317acdd Raise errors when jupyter-command returns nil
* jupyter-env.el (jupyter-runtime-directory): Do it.

* jupyter-kernelspec.el (jupyter-available-kernelspecs): Do it.
2019-07-09 13:47:17 -05:00
Nathaniel Nicandro
9dd8e8d9ec Localize functions defined in jupyter-base.el to their call sites
Fixes #137

* jupyter-base.el (jupyter-kernelspec): Un-require.
(jupyter-command, jupyter-locate-python)
(jupyter-runtime-directory): Move to new file `jupyter-env.el`
(jupyter-include-other-output, jupyter-iopub-message-hook)
(jupyter-shell-message-hook)
(jupyter-stdin-message-hook): Move to `jupyter-client.el`
(jupyter-sha256, jupyter-hmac-sha256):
(jupytern-new-uuid): Move to `jupyter-messages.el`. Add declaration of
`jupyter-new-uuid` to account for its removal.
(jupyter-create-connection-info)
(jupyter-write-connection-file): Move to `jupyter-kernel-manager.el`
(jupyter-connect-endpoint, jupyter-connect-channel): Move to `jupyter-channels.el`

* jupyter-channels.el: Accept moved functions.

* jupyter-client.el: Accept moved variables.

* jupyter-kernel-manager.el: Accept moved functions.
(jupyter-env, jupyter-kernelspec): New requires.

* jupyter-kernelspec (jupyter-env): New require.
(jupyter-command): Remove declaration.
(jupyter-read-plist-from-string): New declaration.

* jupyter-messages.el: Accept moved functions.
(hmac-def, json): New requires.

* jupyter-org-extensions.el (jupyter-kernelspec): New require.

* jupyter-repl.el (jupyter-kernelspec): New require.

* jupyter-env.el: New file.

* ob-jupyter.el (jupyter-env, jupyter-kernelspec): New requires.

* test/jupyter-test.el (jupyter-env): New require.
2019-06-29 10:29:55 -05:00
Nathaniel Nicandro
5ea32a70f0 Change License to GPL3 2019-05-31 09:44:39 -05:00
Nathaniel Nicandro
c9abe85be7 jupyter-available-kernelspecs: Fix for remote hosts 2019-05-09 21:41:26 -05:00
Nathaniel Nicandro
7945b6f444 jupyter-available-kernelspecs: Use --json argument to jupyter command 2019-05-09 19:49:18 -05:00
Nathaniel Nicandro
3628cab446 Refactor of jupyter-kernel-manager.el
This refactor implements a new class hierarchy to manage the lifetime of a
Jupyter kernel. The first node in this hierarchy is the
`jupyter-kernel-lifetime` class which defines a set of methods to manage the
lifetime of a kernel. An object that inherits from `jupyter-kernel-lifetime` is
stating that it has an association with a kernel and can be used to manage the
lifetime of the associated kernel.

The `jupyter-meta-kernel` class inherits from `jupyter-kernel-lifetime` and
mainly defines a `spec` slot used to hold the `kernelspec` from which a command
can be constructed to start a kernel and a `session` slot used to hold the
`jupyter-session` object that clients can use to establish communication with a
kernel once its live. Concrete classes that actually launch kernels are
intended to inherit from this class and use its slots.

`jupyter-kernel-process` manages the lifetime of a kernel started as a process
using the function `start-file-process`, `jupyter-command-kernel` calls the
`jupyter kernel` shell command to start a kernel, finally `jupyter-spec-kernel`
uses the `spec` slot to construct a shell command to start a kernel.

A `jupyter-kernel-manager` now consists of a `kernel` slot that holds a
`jupyter-meta-kernel` and a `control-channel` slot and inherits from
`jupyter-kernel-lifetime`. The `jupyter-kernel-lifetime` methods of the manager
just defer to those of `kernel` while also taking into account the
`control-channel`.

* jupyter-base.el (jupyter-write-connection-file): New function.

* jupyter-channel-ioloop.el
(jupyter-channel-ioloop-add-start-channel-event): Remove `sleep-for` call.
The startup message is not so important anymore.

* jupyter-client.el (jupyter-wait-until-startup: New function.

* jupyter-kernel-manager.el (jupyter-kernel-lifetime)
(jupyter-kernel, jupyter-kernel-process, jupyter-command-kernel)
(jupyter-spec-kernel): New classes.
(jupyter-kernel-manager): Inherit from jupyter-kernel-lifetime only and
implement its methods.
(jupyter-kernel-manager--cleanup, jupyter-kernel-managers)
(jupyter-delete-all-kernels, jupyter--kernel-sentinel)
(jupyter--start-kernel): Remove and remove related, their functionality has
been generalized in the new classes.
(jupyter-interrupt-kernel, jupyter-shutdown-kernel)
(jupyter-start-channels, jupyter-start-kernel, jupyter-kernel-alive-p)
(jupyter-kill-kernel): Refactor and implement to use the new class hierarchy.

* test/jupyter-test.el: Refactor tests to account for changes.
(jupyter-write-connect-file, jupyter-command-kernel): New tests.

* jupyter-kernelspec.el (jupyter-guess-kernelspec): New function.
2019-05-09 12:20:27 -05:00
Nathaniel Nicandro
d8781d594c Fix byte compile warning 2019-05-07 00:38:01 -05:00
Nathaniel Nicandro
112769e0c6
Bump version 2019-05-04 03:31:50 -05:00
Nathaniel Nicandro
b9498b5410
jupyter-available-kernelspecs: Fix documentation 2019-04-22 11:41:28 -05:00
Nathaniel Nicandro
314edc19a8
Wrap jupyter shell command calls into the function jupyter-command
This also removes the use of `shell-command-to-string`, replacing it directly
with `process-file`. `shell-command-to-string` uses `shell-file-name` directly
which may not work properly when `default-directory` is a remote directory as
the remote directory may have a different shell than the local one. See #75.
2019-03-31 10:40:09 -05:00
Nathaniel Nicandro
83af335166
Bump version 2019-03-14 09:29:11 -05:00
Nathaniel Nicandro
d4969cbfcc CHANGELOG.org: Add function to change version numbers 2019-02-14 23:05:00 -06:00
Nathaniel Nicandro
63717b9e39
Bump version 2019-02-12 09:17:06 -06:00
Nathaniel Nicandro
a99863de90 jupyter-completing-read-kernelspec: Fail if no kernelspecs available
Also fail if none of the available kernelspecs were selected.
2019-02-09 14:36:00 -06:00
Nathaniel Nicandro
f9c1088e45
jupyter-kernelspecs-for-mode: More descriptive variable names 2019-01-22 18:39:17 -06:00
Nathaniel Nicandro
4e2e8642ed
Update a few comments 2019-01-22 18:39:17 -06:00
Nathaniel Nicandro
081f329da1 v0.6.0 2018-11-16 00:27:47 -06:00
Nathaniel Nicandro
6f5c106ed5 Add note about mapping kernel languages to Emacs modes 2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
854f660bd3 jupyter-find-kernelspecs allows a regular expression instead of a prefix 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
44ec23bbf2 Support accessing kernelspecs on remote hosts 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
d74a28bc0c Validate the output of jupyter kernelspec list 2018-05-16 21:54:29 -05:00
Nathaniel Nicandro
d93b7d7099 Add jupyter-read-plist 2018-05-15 23:43:32 -05:00
Nathaniel Nicandro
255247788c Remove uses of seq functions
Since this is an emacs 25 dependency and there were not many uses of these
functions, remove them.
2018-02-09 09:11:57 -06:00
Nathaniel Nicandro
0504bf36e0 Update documentation and comments 2018-02-03 19:06:10 -06:00
Nathaniel Nicandro
5cc6c7e475 Update documentation 2018-01-22 18:33:52 -06:00
Nathaniel Nicandro
f93dc7d27d Small refactor of jupyter-available-kernelspecs 2018-01-22 18:31:32 -06:00
Nathaniel Nicandro
2f0b27712c Allow for supplying a list of kernelspecs in jupyter-completing-read-kernelspec 2018-01-22 18:30:38 -06:00
Nathaniel Nicandro
c135d9b334 Just return nil if no kernelspec could be found in jupyter-get-kernelspec 2018-01-22 18:29:57 -06:00
Nathaniel Nicandro
10bcb8859f Add jupyter-completing-read-kernelspec and jupyter-kernelspecs-for-mode 2018-01-17 20:04:40 -06:00
Nathaniel Nicandro
fb0269ae64 Return the resource directory as well as the kernelspec plist
- Also update lots of documentation
2018-01-17 20:02:29 -06:00
Nathaniel Nicandro
b5d9b98f17 Add header to jupyter-kernelspec 2018-01-17 20:00:44 -06:00
Nathaniel Nicandro
b2a9e9bddf Abstract out some functions for working with kernelspecs 2018-01-16 11:10:17 -06:00
Nathaniel Nicandro
b3b1066624 Re-organization of code base
- `jupyter-client.el` only contains client related code

- `jupyter-kernel-manager` related code is placed in `jupyter-kernel-manager.el`

- Socket creating functions and generating connection info plist function are
  placed in `jupyter-connection.el`. This also contains the
  `jupyter-connection` class.

- Kernelspec related functions are placed in `jupyter-kernelspec.el`

- Move general utility functions and variables requires necessary for `jupyter`
  into `jupyter-base.el`. This also contains the `jupyter-session` and
  `jupyter-request` struct definitions.
2018-01-06 19:55:45 -06:00