Guides/Jupyter/Packages

From J Wiki
Jump to navigation Jump to search

This is a work in progress on documenting the Jupyter Notebook packages.

Overview

This page documents the layout of the Standalone Jupyter Notebook packages that are available from the J website. This should also help when adding J support to other Jupyter installations.

The packages contain:

  • the J base system, plus required addons
  • Python3
  • Jupyter, which is an additional package for python
  • additional files in the Python3 folder that provide a J kernel for Jupyter
  • shell scripts to run Jupyter in the packaged environment
  • example notebooks

In addition, the Standalone packages contain:

  • qjide, a web browser based IDE for J. This is included with the system for convenience, but is not essential to using Jupyter.

If you are creating a new Standalone Package or adding J support to other Jupyter installations, then the required files may be obtained from Martin Saurer's jkernel repository on Github at martin-saurer/jkernel, or copied from one of the the packages at download/jupyter.

Notebook Folder

Any folder can be used for the packages. The distributions use folder name JDemo, but this is not required. A typical directory list is:

   dir '~/JDemo'
J805                          <dir>     14-May-17 11:20:30
Jupyter_Notebook_J_Examples   <dir>     14-May-17 11:20:30
Python3                       <dir>     14-May-17 11:20:30
qjide                         <dir>     14-May-17 11:20:30
jhs.sh                              264 14-May-17 11:20:30
jupyter-notebook.sh                 326 14-May-17 11:20:30
qjide.sh                            135 14-May-17 11:20:30

J805

This has the base J system, plus any addons that are required for your notebooks. Any name can be used, and the J806 system can be used, as long as the folder name is changed in other scripts (do a search and replace through the directory).

Jupyter_Notebook_J_Examples

Copy from Martin's github repository or an existing package.

Python3

This is a base installation of Python 3. The recommended method uses Miniconda, which includes the base Python 3 system plus the Conda package manager. The examples below assume Python 3.6 but should also work for later versions of Python.

Jupyter

Once Python is installed, use Conda to install Jupyter into the Python directories:

$ conda install jupyter

J/Jupyter Files

Several files need to be copied into the Python directory. The examples here assume the source is Martin's jkernel repository.

Create any target directories if not already present.

Kernel

Copy the repository directory jkernel to ../Python3/lib/python3.6/site-packages/jkernel.

Kernel Definition

Copy the repository directory kernel_definition/jkernel to: ../Python3/share/jupyter/kernels/jkernel.

Syntax Highlighting

Copy the repository file syntax/J.js to ../Python3/lib/python3.6/site-packages/notebook/static/components/codemirror/mode/J/J.js.

Starting Jupyter

Copy the appropriate file from an existing installation package, and update as needed, i.e.

jupyter-notebook.sh          Linux
jupyter-notebook.command     macOS
jupyter-notebook.bat         Windows

The packages and Jupyter kernels were provided by Martin Saurer.