Skip to content

Commit a5f8d99

Browse files
committed
Introduce new file and custom variable
* jupyter-server-ioloop-comm.el: New file. * jupyter-server.el (jupyter-server-use-zmq): New variable. (jupyter-server-abstract-kcomm): New class. (jupyter-server-kernel-comm): Inherit from it. This is in preparation of re-purposing the class in a future commit.
1 parent 1a739fe commit a5f8d99

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

jupyter-server-ioloop-comm.el

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
;;; jupyter-server-ioloop-comm.el --- Async support for Jupyter kernel servers -*- lexical-binding: t -*-
2+
3+
;; Copyright (C) 2020 Nathaniel Nicandro
4+
5+
;; Author: Nathaniel Nicandro <nathanielnicandro@gmail.com>
6+
;; Created: 11 Mar 2020
7+
8+
;; This program is free software; you can redistribute it and/or
9+
;; modify it under the terms of the GNU General Public License as
10+
;; published by the Free Software Foundation; either version 3, or (at
11+
;; your option) any later version.
12+
13+
;; This program is distributed in the hope that it will be useful, but
14+
;; WITHOUT ANY WARRANTY; without even the implied warranty of
15+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+
;; General Public License for more details.
17+
18+
;; You should have received a copy of the GNU General Public License
19+
;; along with GNU Emacs; see the file COPYING. If not, write to the
20+
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21+
;; Boston, MA 02111-1307, USA.
22+
23+
;;; Commentary:
24+
25+
;; Async support for Jupyter kernel servers. Requires ZMQ.
26+
27+
;;; Code:
28+
29+
(require 'jupyter-server)
30+
(require 'jupyter-ioloop-comm)
31+
(require 'jupyter-server-ioloop)
32+
33+
(defgroup jupyter-server-ioloop-comm nil
34+
"Async support for Jupyter kernel servers (requires ZMQ)."
35+
:group 'jupyter)
36+
37+
(defclass jupyter-server-ioloop-comm (jupyter-server jupyter-ioloop-comm)
38+
())
39+
40+
(defclass jupyter-server-ioloop-kernel-comm (jupyter-server-abstract-kcomm)
41+
())
42+
43+
(provide 'jupyter-server-ioloop-comm)
44+
45+
;;; jupyter-server-ioloop-comm.el ends here

jupyter-server.el

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@
8888
"Support for the Jupyter kernel gateway"
8989
:group 'jupyter)
9090

91+
(defcustom jupyter-server-use-zmq (and (locate-library "zmq") t)
92+
"Whether or not ZMQ should be used as a backend."
93+
:type 'boolean
94+
:group 'jupyter)
95+
9196
(defvar-local jupyter-current-server nil
9297
"The `jupyter-server' associated with the current buffer.
9398
Used in, e.g. a `jupyter-server-kernel-list-mode' buffer.")
@@ -159,8 +164,12 @@ Access should be done through `jupyter-available-kernelspecs'.")))
159164
;; The notebook server already takes care of forcing shutdown of a kernel.
160165
(ignore))
161166

162-
(defclass jupyter-server-kernel-comm (jupyter-comm-layer)
163-
((kernel :type jupyter-server-kernel :initarg :kernel)))
167+
(defclass jupyter-server-abstract-kcomm (jupyter-comm-layer)
168+
((kernel :type jupyter-server-kernel :initarg :kernel))
169+
:abstract t)
170+
171+
(defclass jupyter-server-kernel-comm (jupyter-server-abstract-kcomm)
172+
())
164173

165174
(cl-defmethod jupyter-comm-id ((comm jupyter-server-kernel-comm))
166175
(let* ((kernel (oref comm kernel))

0 commit comments

Comments
 (0)