Emacs minor mode for generating EIN notebooks
Project description
Emacs minor mode for generating and interacting with jupyter notebooks.
Quick Start
First install the codebook module from PyPI with pip.
pip install codebook
pynt is available for download through MELPA. Once you have configured emacs to use MELPA then run the following commands in emacs.
M-x package-install RET pynt C-x C-f my-python-file.py M-x pynt-mode
Feature List
Jupyter notebook server management
A jupyter notebook server will be started in your home directory when you start emacs so you don’t have to.
On-the-fly notebook creation
Every code region gets its own jupyter notebook and these jupyter notebooks are generated automatically.
Attach a jupyter notebook to a running process
Launch a process from the command line which hits the code region. Restart the kernel in the notebook to attach to that process.
Dump code into jupyter notebooks
No more copy and pasting from code into jupyter notebooks. Each expression gets its own cell. Assignment expressions are further transformed so that when you evaluate its cell the value of the target is displayed.
Loop rewriting
Unroll the first pass of loops for easy interaction in a notebook.
Scroll the resulting jupyter notebook with the code buffer
Scrolling the code buffer scrolls the notebook along with it, even when cells are modified.
Multiple notebooks in one window
Put code and tests on top of each other and have their corresponding notebooks alongside.
Using pynt
Once you have opened a python file and pynt mode is active you should select the region of code you would like to dump into a jupyter notebook by typing C-c C-s and cycling though the resulting code regions. Once you have made a selection hit C-c C-e to dump that code region into a jupyter notebook.
It is recommended at this point to enable pynt-scroll-mode which scrolls (i.e. aligns) the notebook cells with the code lines. You can activate pynt-scroll-mode with M-x pynt-scroll-mode RET.
EIN Tweaks
There are a few tweaks to EIN that make the pynt/EIN experience nicer IMO.
Have C-<return> and S-<return> behave as they would in a jupyter web browser client
Arrow through the worksheets in a EIN notebook buffer (warning: evil-specific)
Prevent jupyter from popping open a new tab in your web browser on startup
Screenshots
Jupyter Notebook Web Browser Client
Emacs IPython Notebook Client
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.