A REPL interface to communicate with Jupyter kernels in Emacs or CLI.
Table of Contents
Installation
inf-ipy
is made up of two parts. Python part that handles
communication with Jupyter and provides two REPL interfaces one
specialized for use in command line and one specialized for in Emacs.
Machines that will run the kernels or connect to them only requires
SSH
and Jupyter
to be installed. Tested on Linux
/ Windows
.
Using Package Managers
Python
pip install inf-ipy
Emacs Using quelpa
(quelpa
'(inf-ipy
:fetcher github
:repo "nakkaya/inf-ipy"
:files ("src/emacs/*.el")))
Emacs from MELPA (Pending Approval)
M-x package-install RET inf-ipy RET
Manual
Clone this repository then install individual parts.
For python,
cd src/python
pip install .
For Emacs,
(load-file "src/emacs/inf-ipy.el")
Quickstart
Create a configuration file config.ini
that describes how to login
and launch a kernel on a machine.
[SERVER]
;; SSH IP
host = 10.9.0.150
;; SSH User
user = core
;; Use named kernel connection file instead of random file name
file = server.json
For a complete list of options use inf-ipy --help
. All options can
be supplied via the configuration file or command line switches.
To start a kernel and download the connection file.
inf-ipy --start
To stop the kernel.
inf-ipy --stop
To select a different kernel other than Python --kernel
option
can be used. To start a Matlab kernel use.
inf-ipy --start --kernel matlab_kernel.kernel.MatlabKernel
CLI
To interact with the kernel via command line.
inf-ipy --repl
Emacs
(require 'inf-ipy)
Once a kernel is started (using a configuration file) an Emacs REPL to
that kernel can be created using M-x inf-ipy-repl
.
Integration with org-babel
can be enabled using,
;; Enable org-babel support for Python and Matlab
(inf-ipy-configure-kernel python)
(inf-ipy-configure-kernel matlab)
To interact with a python kernel you would create a new source block using,
#+BEGIN_SRC inf-ipy-python :results output %matplotlib inline import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax = plt.axes() x = np.linspace(0, 10, 1000) ax.plot(x, np.sin(x)); #+END_SRC