Commit graph

1545 commits

Author SHA1 Message Date
Nathaniel Nicandro
047968c4e9 Refactor jupyter-start-channel 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
a7539dc37b Fix checkdoc warnings 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
c7dee4aa55 Simplify kernel shutdown and interruptions in a kernel manager 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
d44d9d0c64 Actually set the kernel process of a manager when starting the kernel 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
14e02c95bf Handle {resource_dir} when starting kernel 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
9ba6ad331e Remove uses of lexical-let 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
326ff15d92 Add standard header comments 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
ebd616998e Add/update lots of documentation 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
85fe15ae4c Only unfinalized cells can have their code replaced
Don't set `inhibit-read-only` to t when replacing cell code. This prevents one
from replacing the cell code of a finalized cell.
2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
6178a53638 Refactor jupyter-start-new-kernel to use jupyter-missing-request 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
7e36ea1101 Add jupyter-missing-request
This is a function which should be called on a `jupyter-kernel-client` and it
returns a request object which can be used to add callbacks to messages that
have no parent message such as the status: startup message sent be a kernel.
2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
7169c5072a warn instead of error when handling unknown message types 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
44c75944d3 Fix missing argument 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
c500b08104 Set default values for the jupyter-connection slots of a jupyter-kernel-manager 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
f904dc7d2a Rename jupyter-push-message -> jupyter-queue-message 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
c706d07f02 Refactor jupyter--ioloop
Break it into several macros which perform various subtasks like processing a
command received from the parent emacs process and collecting messages into a
sorted list based on `jupyter-message-time`
2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
b846af6c00 Remove unreachable code 2018-01-07 19:54:52 -06:00
Nathaniel Nicandro
71c4314a86 jupyter-connection inherits from eieio-instance-inheritor
This way when creating kernel clients with `jupyter-kernel-manager`, we can set
the `parent-instance` of the newly created client to the manager thereby
inheriting the `jupyter-session` from the kernel manager.

Also have `jupyter-channel` objects inherit from a `jupyter-connection` so that
we can define `jupyter-send` and `jupyter-recv` methods for channels in the future.
2018-01-07 14:53:12 -06:00
Nathaniel Nicandro
c09aebaa6a Fix wrong function names 2018-01-07 14:45:20 -06:00
Nathaniel Nicandro
5975e0e096 Update tests
Use lexical bindings, fix byte compiler warnings.
2018-01-07 14:25:54 -06:00
Nathaniel Nicandro
346cdc78c8 Update heartbeat channel tests to take into account implementation changes 2018-01-07 14:16:17 -06:00
Nathaniel Nicandro
9e2db2146b [WIP] Back to the old prefix behavior in company-jupyter-repl
This needs to be changed. `company-grab-symbol` will only grab 'bar' when
cursor is at | in the following:

    foo.bar|

We would like it to grab the whole 'foo.bar' and let the kernel figure out what
to do. Similarly for other operators like '->'. The problem that needs to be
fixed is to properly replace just the 'bar' part if 'foo.bar' is the prefix. I
believe the `match` command of a company backend will be of use.
2018-01-07 14:10:52 -06:00
Nathaniel Nicandro
8431e6834b Insert newlines in the jupyter-repl-client buffer when appropriate 2018-01-07 14:10:24 -06:00
Nathaniel Nicandro
9be91260c7 Refactor setting inserted text properties in jupyter-repl-insert 2018-01-07 14:09:39 -06:00
Nathaniel Nicandro
f003e40101 Add more documentation 2018-01-07 14:06:14 -06:00
Nathaniel Nicandro
aff8f7dc5d Fix wrong number of arguments 2018-01-07 14:03:55 -06:00
Nathaniel Nicandro
ada66074f5 Fix some checkdoc warnings 2018-01-07 13:35:05 -06:00
Nathaniel Nicandro
b31aa780a3 Use cl-defgeneric for client handlers and requests methods
This way eldoc works with the method arguments
2018-01-06 22:50:55 -06:00
Nathaniel Nicandro
4896c6b75b Use pcase in jupyter--ioloop-filter
Also change the type of objects emitted by `jupyter--ioloop` to lists
2018-01-06 21:04:03 -06:00
Nathaniel Nicandro
f42a22c586 Update jupyter--ioloop to take into account changes in with-zmq-poller
Namely that `current-zmq-poller` is no longer available and the first argument of `with-zmq-poller` will be bound to a poller object.
2018-01-06 21:03:37 -06:00
Nathaniel Nicandro
50fb035862 Call inhibit-read-only in jupyter-repl-replace-cell-code 2018-01-06 19:56:57 -06:00
Nathaniel Nicandro
eb476b6cbf Add .gitignore and a README file 2018-01-06 19:56:57 -06:00
Nathaniel Nicandro
504f1ccc14 Use jupyter-start-new-kernel when initializing the REPL 2018-01-06 19:56:57 -06:00
Nathaniel Nicandro
312f8d5ce8 Refactor the kernel initialization process in jupyter-kernel-manager
Also add `jupyter-start-new-kernel` which starts a kernel and initializes a
client connected to the kernel.
2018-01-06 19:56:56 -06:00
Nathaniel Nicandro
3d78e2f00f Update comments and documentation 2018-01-06 19:56:54 -06:00
Nathaniel Nicandro
4944a5d75a Update callback interface
- Rename `jupyter-received-message-types` to `jupyter-message-types` and add
  message types for requests as well. Also change the keys to keywords instead
  of symbols. Using plists with keywords is in line with `jupyter-messages` and
  the arguments of the jupyter request functions.

- Rename `jupyter-request-run-callbacks` to `jupyter--run-callbacks`. This is
  more of an internal function so mark it as such.

- Change the order of the first two arguments in `jupyter-add-callback` and
  `jupyter-wait-until`. In both cases you are adding a callback to a request or
  waiting for some condition to be satisfied on the request not on the message
  type. This is also the reason why `jupyter-wait-until-received` keeps the
  message type as the first argument. We are waiting until a message of a
  certain type is received for a request, but the more important object in this
  case is the message type.

- Update other files to take into account these changes.
2018-01-06 19:55:46 -06:00
Nathaniel Nicandro
d1f57831fe Update callback tests to use jupyter-echo-client 2018-01-06 19:55:46 -06:00
Nathaniel Nicandro
e679c28dc4 Add jupyter-echo-client for tests
This `jupyter-kernel-client` subclass generates the following messages when a
message is sent on one of its channels:

status: busy
<msg>
status: idle

Where the content field of <msg> will be the same plist as the sent message and
the type of <msg> is the reply type of the request. No actual communication is
done with a kernel, the messages are just placed on each channels recv-queue
2018-01-06 19:55:46 -06:00
Nathaniel Nicandro
95dbc187eb Be consistent with how channels are initialized in jupyter-initialize-connection 2018-01-06 19:55:46 -06:00
Nathaniel Nicandro
cfdf68eb43 Remove channel in some jupyter-channel method names 2018-01-06 19:55:46 -06:00
Nathaniel Nicandro
b19fdbbd10 Rename jupyter-terminal-client.el to jupyter-repl-client.el 2018-01-06 19:55:46 -06:00
Nathaniel Nicandro
2ec5982743 Cleanup comments 2018-01-06 19:55:46 -06:00
Nathaniel Nicandro
dab44e6848 Add support for svg images 2018-01-06 19:55:46 -06:00
Nathaniel Nicandro
619d65f1c4 Be more obvious when naming variables 2018-01-06 19:55:45 -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
Nathaniel Nicandro
cc3719dedd Rename jupyter-client-initialize-connection to jupyter-initialize-connection
Also update the documentation.
2018-01-06 19:55:45 -06:00
Nathaniel Nicandro
bf1b1dae42 Add jupyter-default-timeout variable 2018-01-06 19:55:45 -06:00
Nathaniel Nicandro
27c588ebf4 Use slot-value instead of eieio-oref 2018-01-06 19:55:45 -06:00
Nathaniel Nicandro
6fabeeeadf Take into account changes to REPL initialization in jupyter-repl-ret
Specifically the REPL is always initialized with a new prompt due to
`jupyter-repl-update-execution-counter` being called as the final step in REPL
initialization. This means that there is no need to catch a
`beginning-of-buffer` error in `jupyter-repl-ret`.

Also remove the need for the `code` variable, just use `jupyter-repl-cell-code`
directly in the `jupyter-is-complete-request`.
2018-01-06 19:55:45 -06:00
Nathaniel Nicandro
184ba4cca6 Use jupyter-message functions 2018-01-06 19:55:45 -06:00