Skip to content

stisa/jupyter-nim-kernel

 
 

Repository files navigation

Minimal Nim kernel for Jupyter

This is a rough adaptation of https://github.com/brendan-rius/jupyter-c-kernel . It's mostly functional, there are probably bugs lurking around.  

There's a nim based version, which I will be focusing work on, here : Inim  

Look at example-notebook for some examples.

NOTE: Context is NOT shared between blocks!! I'll try working on it when I have time.

Magics

Currently implemented magics are:

  • #>loadblock <num> : load block num in the current block, automatically disables echo calls in loaded block.
    Partial workaround for sharing context.
  • #>passflag <someflag> : pass a flag to the compiler, eg --verbosity:3, --d:openblas etc.
    Currently one flag per line

Prereqs

  • a working nim installation ( download )
  • a working jupyter (and python 3^) installation ( I recomend miniconda3 and adding jupyter with conda install jupyter )

Installation

  • pip install jupyter_nim_kernel
  • git clone https://github.com/stisa/jupyter-nim-kernel.git
  • cd jupyter-nim-kernel
  • jupyter-kernelspec install nim_spec/
  • Done, now run jupyter-notebook and select new->Nim

Manual Installation

  • git clone https://github.com/stisa/jupyter-nim-kernel.git
  • cd jupyter-nim-kernel
  • pip install -e .
  • jupyter-kernelspec install nim_spec/
  • Done, now run jupyter-notebook and select new->Nim

Note

Forked from https://github.com/brendan-rius/jupyter-c-kernel and adapted to work with nim.

This a simple proof of concept. It's not intended to be used in production in its current shape.

Known bugs

  • The output is littered with Hint: [Processing]... statements
  • Every block is treated as a separate file ( not really a bug, it's just not yet implemented )
  • Others?

License

MIT

TODO

  • have a look at implementing nimsuggest
  • share context between blocks ( or at least procs, maybe an internal file that adds all procs and then is included before compilation? )
  • snippets
  • basic completion

About

Simple Jupyter Nim kernel

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 47.5%
  • Jupyter Notebook 44.8%
  • Shell 4.8%
  • Nim 2.9%