/jupyterq

Jupyter kernel for kdb+

Primary LanguageJupyter NotebookApache License 2.0Apache-2.0

jupyterq

Jupyter kernel for kdb+. Features include

  • Syntax Highlighting for q
  • Code completion for q keywords, .z/.h/.Q/.j namespace functions, and user defined variables
  • Code help for q keywords and basic help (display and type information) for user defined objects
  • script like execution of code (mulitline input)
  • Inline display of charts created using embedPy and matplotlib
  • console stdout/stderr capture and display in notebooks
  • Inline loading and saving of scripts into and from notebook cells

Requirements

  • kdb+>= v3.5 64-bit
  • Python >= 3.5
  • embedPy

Overview

You can either

  • Install jupyterq to run on your local machine; or
  • Download or build a Docker image in which to run jupyterq

There are two ways to install jupyterq on your local machine:

  1. Download and install a release

  2. Install with Conda - recommended if you are already using Anaconda Python

Install on local machine

Download and install a release

  1. Make sure you have installed embedPy

  2. Download a release archive from the releases page, and unzip it.

  3. Install the required Python packages with

    pip

    pip install -r requirements.txt

    or with conda

    conda install --file requirements.txt
  4. Ensure QHOME is set and you have a working version of q in your PATH, note that jupyter will not pick up bash aliases when starting q, the location of the q executable needs to be in your PATH.

  5. Run the install script

    Linux/macOS

      ./install.sh

    Windows

     install.bat
    

Install with Conda

  1. Download and install either the full Anaconda distribution or Miniconda for Python3.

  2. Use the conda to install jupyterq and it's dependencies

conda install -c kx jupyterq
  1. Ensure you can run q before running jupyterq for the first time, you may need to generate an on demand licence
q
...
q)\\

Running after install

To run the jupyter console

jupyter console --kernel=qpk

To run the example notebook

jupyter notebook kdb+Notebooks.ipynb

Run a Docker Image

If you have Docker installed you can alternatively run:

docker run -it -p 8888:8888 --name myjupyterq kxsys/jupyterq

Now point your browser at http://localhost:8888/notebooks/kdb%2BNotebooks.ipynb.

For subsequent runs, you will not be prompted to redo the license setup when calling:

docker start -ai myjupyterq

N.B. instructions regarding headless/presets are available

N.B. build instructions for the image are available

Using notebooks

See the notebook kdb+Notebooks.ipynb for full interactive examples and explanation, it should be viewable on github.

Documentation

Documentation is available on the jupyterq homepage.