mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-06 07:51:39 -05:00
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.
This commit is contained in:
parent
f2555b772f
commit
3e7bd859c8
2 changed files with 56 additions and 2 deletions
45
jupyter-server-ioloop-comm.el
Normal file
45
jupyter-server-ioloop-comm.el
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
;;; jupyter-server-ioloop-comm.el --- Async support for Jupyter kernel servers -*- lexical-binding: t -*-
|
||||||
|
|
||||||
|
;; Copyright (C) 2020 Nathaniel Nicandro
|
||||||
|
|
||||||
|
;; Author: Nathaniel Nicandro <nathanielnicandro@gmail.com>
|
||||||
|
;; Created: 11 Mar 2020
|
||||||
|
|
||||||
|
;; This program is free software; you can redistribute it and/or
|
||||||
|
;; modify it under the terms of the GNU General Public License as
|
||||||
|
;; published by the Free Software Foundation; either version 3, or (at
|
||||||
|
;; your option) any later version.
|
||||||
|
|
||||||
|
;; This program is distributed in the hope that it will be useful, but
|
||||||
|
;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
;; General Public License for more details.
|
||||||
|
|
||||||
|
;; You should have received a copy of the GNU General Public License
|
||||||
|
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
||||||
|
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
;; Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Async support for Jupyter kernel servers. Requires ZMQ.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'jupyter-server)
|
||||||
|
(require 'jupyter-ioloop-comm)
|
||||||
|
(require 'jupyter-server-ioloop)
|
||||||
|
|
||||||
|
(defgroup jupyter-server-ioloop-comm nil
|
||||||
|
"Async support for Jupyter kernel servers (requires ZMQ)."
|
||||||
|
:group 'jupyter)
|
||||||
|
|
||||||
|
(defclass jupyter-server-ioloop-comm (jupyter-server jupyter-ioloop-comm)
|
||||||
|
())
|
||||||
|
|
||||||
|
(defclass jupyter-server-ioloop-kernel-comm (jupyter-server-abstract-kcomm)
|
||||||
|
())
|
||||||
|
|
||||||
|
(provide 'jupyter-server-ioloop-comm)
|
||||||
|
|
||||||
|
;;; jupyter-server-ioloop-comm.el ends here
|
|
@ -88,6 +88,11 @@
|
||||||
"Support for the Jupyter kernel gateway"
|
"Support for the Jupyter kernel gateway"
|
||||||
:group 'jupyter)
|
:group 'jupyter)
|
||||||
|
|
||||||
|
(defcustom jupyter-server-use-zmq (and (locate-library "zmq") t)
|
||||||
|
"Whether or not ZMQ should be used as a backend."
|
||||||
|
:type 'boolean
|
||||||
|
:group 'jupyter)
|
||||||
|
|
||||||
(defvar-local jupyter-current-server nil
|
(defvar-local jupyter-current-server nil
|
||||||
"The `jupyter-server' associated with the current buffer.
|
"The `jupyter-server' associated with the current buffer.
|
||||||
Used in, e.g. a `jupyter-server-kernel-list-mode' buffer.")
|
Used in, e.g. a `jupyter-server-kernel-list-mode' buffer.")
|
||||||
|
@ -159,8 +164,12 @@ Access should be done through `jupyter-available-kernelspecs'.")))
|
||||||
;; The notebook server already takes care of forcing shutdown of a kernel.
|
;; The notebook server already takes care of forcing shutdown of a kernel.
|
||||||
(ignore))
|
(ignore))
|
||||||
|
|
||||||
(defclass jupyter-server-kernel-comm (jupyter-comm-layer)
|
(defclass jupyter-server-abstract-kcomm (jupyter-comm-layer)
|
||||||
((kernel :type jupyter-server-kernel :initarg :kernel)))
|
((kernel :type jupyter-server-kernel :initarg :kernel))
|
||||||
|
:abstract t)
|
||||||
|
|
||||||
|
(defclass jupyter-server-kernel-comm (jupyter-server-abstract-kcomm)
|
||||||
|
())
|
||||||
|
|
||||||
(cl-defmethod jupyter-comm-id ((comm jupyter-server-kernel-comm))
|
(cl-defmethod jupyter-comm-id ((comm jupyter-server-kernel-comm))
|
||||||
(let* ((kernel (oref comm kernel))
|
(let* ((kernel (oref comm kernel))
|
||||||
|
|
Loading…
Add table
Reference in a new issue