Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nakkaya/inf-ipy
A REPL interface to communicate with Jupyter kernels in Emacs or CLI.
https://github.com/nakkaya/inf-ipy
Last synced: 3 months ago
JSON representation
A REPL interface to communicate with Jupyter kernels in Emacs or CLI.
- Host: GitHub
- URL: https://github.com/nakkaya/inf-ipy
- Owner: nakkaya
- License: bsd-2-clause
- Created: 2019-10-24T20:49:48.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-04T12:14:53.000Z (almost 5 years ago)
- Last Synced: 2024-09-18T00:10:00.056Z (4 months ago)
- Language: Python
- Homepage:
- Size: 77.1 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.org
- License: LICENSE
Awesome Lists containing this project
README
A REPL interface to communicate with Jupyter kernels in Emacs or CLI.
* Table of Contents :TOC:
- [[#Installation][Installation]]
- [[#Quickstart][Quickstart]]
- [[#CLI][Command Line Interface]]
- [[#Emacs][Emacs Interface]]#+attr_html: :width 80%
[[https://s3.amazonaws.com/dropbox.nakkaya.com/inf-ipy.png]]* 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
#+BEGIN_SRC bash
pip install inf-ipy
#+END_SRCEmacs Using [[https://github.com/quelpa/quelpa][quelpa]]
#+BEGIN_SRC emacs-lisp
(quelpa
'(inf-ipy
:fetcher github
:repo "nakkaya/inf-ipy"
:files ("src/emacs/*.el")))
#+END_SRCEmacs from MELPA (Pending Approval)
#+BEGIN_EXAMPLE
M-x package-install RET inf-ipy RET
#+END_EXAMPLE** Manual
Clone this repository then install individual parts.
For python,
#+BEGIN_SRC bash
cd src/python
pip install .
#+END_SRCFor Emacs,
#+BEGIN_SRC emacs-lisp
(load-file "src/emacs/inf-ipy.el")
#+END_SRC* Quickstart
Create a configuration file =config.ini= that describes how to login
and launch a kernel on a machine.#+BEGIN_SRC conf
[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
#+END_SRCFor 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.
#+BEGIN_SRC bash
inf-ipy --start
#+END_SRCTo stop the kernel.
#+BEGIN_SRC bash
inf-ipy --stop
#+END_SRCTo select a different kernel other than Python =--kernel= option
can be used. To start a Matlab kernel use.#+BEGIN_SRC bash
inf-ipy --start --kernel matlab_kernel.kernel.MatlabKernel
#+END_SRC** CLI
To interact with the kernel via command line.
#+BEGIN_SRC bash
inf-ipy --repl
#+END_SRC** Emacs
#+BEGIN_SRC emacs-lisp
(require 'inf-ipy)
#+END_SRCOnce 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,
#+BEGIN_SRC emacs-lisp
;; Enable org-babel support for Python and Matlab
(inf-ipy-configure-kernel python)
(inf-ipy-configure-kernel matlab)
#+END_SRCTo interact with a python kernel you would create a new
source block using,#+BEGIN_EXAMPLE
,#+BEGIN_SRC inf-ipy-python :results output
%matplotlib inlineimport numpy as np
import matplotlib.pyplot as pltfig = plt.figure()
ax = plt.axes()x = np.linspace(0, 10, 1000)
ax.plot(x, np.sin(x));
,#+END_SRC
#+END_EXAMPLE