Commit graph

1445 commits

Author SHA1 Message Date
Nathaniel Nicandro
ea8176d6fa jupyter-start-new-kernel: Remove unreliable jupyter-wait-until-startup 2019-05-09 20:10:49 -05:00
Nathaniel Nicandro
099d2b6511 jupyter-start-kernel (jupyter-command-kernel): Directly use Jupyter's python
instead of relying on the `jupyter kernel` command
2019-05-09 20:10:49 -05:00
Nathaniel Nicandro
258d1edfdb Shutdown kernel after jupyter-command-kernel test 2019-05-09 19:49:45 -05:00
Nathaniel Nicandro
f158f10c12 jupyter-start-kernel (jupyter-kernel-process): Display process arguments 2019-05-09 19:49:45 -05:00
Nathaniel Nicandro
ac7ed04488 appveyor.yml: Swap stderr and stdout when running cask 2019-05-09 19:49:45 -05:00
Nathaniel Nicandro
3f0a4b7829 Make jupyter-write-connection-file test more reliable 2019-05-09 19:49:45 -05:00
Nathaniel Nicandro
7945b6f444 jupyter-available-kernelspecs: Use --json argument to jupyter command 2019-05-09 19:49:18 -05:00
Nathaniel Nicandro
b715ada492 Always name method arguments
If method arguments are not named it gives rise to errors like

    `Args out of range: "", 0`

that originate in `help-function-arglist` when calling `describe-function` on
those methods.
2019-05-09 13:32:45 -05:00
Nathaniel Nicandro
64d9c773df Make jupyter-weak-ref test more reliable 2019-05-09 12:51:00 -05:00
Nathaniel Nicandro
eb3708fa0c .travis.yml: Limit output when installing Emacs 2019-05-09 12:50:00 -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
ab79985580 Fix initialize-instance method signature 2019-05-09 10:56:02 -05:00
Nathaniel Nicandro
edb452618e jupyter-test-with-client-cache: Call accept-process-output 2019-05-09 10:36:43 -05:00
Nathaniel Nicandro
cdfefd5002 Increase timeouts during testing 2019-05-09 09:41:19 -05:00
Nathaniel Nicandro
c18de820e9 .travis.yml: Quiet shell output during testing 2019-05-09 09:41:19 -05:00
Nathaniel Nicandro
c9770d1789 appveyor.yml: Call WaitForExit() on the Emacs process before checking its exit code 2019-05-09 08:41:16 -05:00
Nathaniel Nicandro
d0000e8382 org-babel-jupyter-aliases-from-kernelspecs: Use symbols in org-src-lang-modes
This avoids a bug in `org-mode`. Although the documentation of
`org-src-lang-modes` says the mode can be a symbol or a string, the
customization type only specifies symbol so having a string causes errors when
`custom-initialize-reset` is called after
`org-babel-jupyter-aliases-from-kernelspecs`.
2019-05-08 23:26:07 -05:00
Nathaniel Nicandro
5cd1e55616 org-babel-jupyter-strip-ansi-escapes: Handle blocks without results
Fixes #112.
2019-05-08 10:36:38 -05:00
Nathaniel Nicandro
4302da35ef Shutdown kernel properly when testing 2019-05-07 22:47:22 -05:00
Nathaniel Nicandro
e948d4f705 Try to make jupyter-weak-ref test more reliable 2019-05-07 22:47:22 -05:00
Nathaniel Nicandro
1d8f28f2fc Simplify test macros
Also fix misuse of `alist-get`. `alist-get` uses `assq` for comparison by
default, but we are comparing strings. This caused issues when caching REPL
buffers and the subsequent re-use of them during testing.
2019-05-07 17:30:16 -05:00
Nathaniel Nicandro
87d078edca Add more tests
* Add tests for `jupyter-weak-ref`, `jupyter-add-finalizer`, and `jupyter-eval`
2019-05-07 17:30:16 -05:00
Nathaniel Nicandro
820202eca7 Fix typo 2019-05-07 00:38:01 -05:00
Nathaniel Nicandro
178ce69ace Clarify documentation of jupyter-channel methods 2019-05-07 00:38:01 -05:00
Nathaniel Nicandro
2091a01b52 org-babel-jupyter-strip-ansi-escapes: Avoid when-let* 2019-05-07 00:38:01 -05:00
Nathaniel Nicandro
d8781d594c Fix byte compile warning 2019-05-07 00:38:01 -05:00
Ning Xu
59275f655a Fix two org-src-lang-modes calc issues (#107)
For assoc lang org-src-lang-modes may return symbol sh, (inter 'sh) will
return an error.

For some languages like C++, the corresponding language mode shall be c++
2019-05-06 23:53:29 -05:00
Nathaniel Nicandro
abd7bed138
Fast finish when testing on Travis 2019-05-04 09:33:38 -05:00
Nathaniel Nicandro
112769e0c6
Bump version 2019-05-04 03:31:50 -05:00
Nathaniel Nicandro
598359459c
jupyter-R.el: Fix byte compilation warnings 2019-05-04 02:56:08 -05:00
Nathaniel Nicandro
0357961777 Add Appveyor build script 2019-05-04 02:33:11 -05:00
Nathaniel Nicandro
c8dd1236df Generalize tests for Windows 2019-05-04 02:33:11 -05:00
Nathaniel Nicandro
f4bf16079d jupyter-start-kernel: Don't check access time of conn. file on Windows 2019-05-04 02:33:11 -05:00
Nathaniel Nicandro
f890238345 Handle Windows systems when using jupyter-ioloop
On Windows systems we can't poll the STDIN of the created subprocess when using
`jupyter-ioloop` since Windows does not allow polling file handles. To get
around this we create a (PUSH, PULL) socket pair that the parent Emacs process
uses to communicate with its subprocess. See dzop/emacs-zmq#10 and thanks to
@fleimgruber for investigating this issue.
2019-05-04 02:33:11 -05:00
Nathaniel Nicandro
32ce45b707
Fix Travis 2019-05-04 01:41:31 -05:00
Nathaniel Nicandro
4a07dc143e
Add test for jupyter-ioloop-wait-until 2019-05-04 01:27:54 -05:00
Nathaniel Nicandro
1ff22c1827
jupyter-ioloop-last-event: Return nil when there is no process 2019-05-04 01:27:54 -05:00
Nathaniel Nicandro
67d7bce1e3
jupyter-ioloop-add-callback: Use jupyter-send 2019-05-04 01:27:54 -05:00
Nathaniel Nicandro
6bb9390c0e
Update Travis build script 2019-05-04 01:25:59 -05:00
Nathaniel Nicandro
ea9c752823
Bump required zmq version 2019-05-03 14:02:40 -05:00
Nathaniel Nicandro
3f382a8fe8
Require ob-python when its needed 2019-05-03 14:02:01 -05:00
jackkamm
748598b7be Add pandoc conversion of rich outputs (#97) 2019-04-28 15:17:19 -05:00
jackkamm
18a3a27139 Remove buggy R html parsing (#96) 2019-04-28 15:12:23 -05:00
Nathaniel Nicandro
9d685b0be4
jupyter-repl-mode-map: Don't override default point motion keys
Closes #100
2019-04-25 12:04:41 -05:00
UndeadKernel
f6421ab72e org-extensions: (un)fold src block hydra command (#95) 2019-04-24 21:56:47 -05:00
Nathaniel Nicandro
81de2fba62
Add initial support for C++ 2019-04-22 17:38:09 -05:00
Nathaniel Nicandro
b9498b5410
jupyter-available-kernelspecs: Fix documentation 2019-04-22 11:41:28 -05:00
Nathaniel Nicandro
9dc814e38a
Add test for jupyter-connect-repl 2019-04-15 21:39:55 -05:00
Nathaniel Nicandro
9d39fbeaff
jupyter-connect-repl: Set kcomm slot of client before initializing connection
Fixes #92
2019-04-15 21:39:55 -05:00
Nathaniel Nicandro
8926e90f37
jupyter-handle-is-complete-reply (jupyter-repl-client): Handle unknown status 2019-04-12 17:06:14 -05:00