POC of a K-Kernel for IPyton that is intended to be used with Jupyter Noteboooks. As the name suggests, this is just a POC and hasn't been rigorously tested or built to feature comppletion. However, it does demonstrate that Jupyter Notebooks may be a useful way to expose the K
language interactively online.
Since K
is a meta-language, this makes Notebooks a little more complex than a standard language. For this reason, there are four types of code cells:
K
-definition fragments - all cells are treated as fragments of one giantK
definition, by default. The cells are not compiled when you "run" them in the Notebook. Rather they are simply buffered for later use.- Kompile cells. These are any cells that start with the term
kompile
. Such cells willkompile
all previously encounteredK
-fragments into a new file, according to thekompile
command given. - Kommand cells. These are cells that run specific
K
commands likekrun
orkparse
. - Kode cells. These cells should start with a comment on the first line in the format
//kode-file: FILE_NAME
. Subsequent lines should contain the code. Such cells will result in a file by the name ofFILE_NAME
being created, whose contents are the code.
The installation assumes you have K
installed and also python3
. It also assumes that you've aliased python3
as python
e.g. see here. Since this is a POC only, it has only been published to test PyPi. To install as a user, do:
pip install --index-url https://test.pypi.org/simple/ k_jupyter_poc
python -m k_jupyter_poc.install --user
To uninstall, do:
jupyter kernelspec uninstall k
pip uninstall k_jupyter_poc
Note: the pakcage will be listed in pip
as k-jupyter-poc
(with dashes) rather than k_jupyter_poc
(with underscores).
This doesn't seem to be an issue. More on this here.
This assumes you have jupyter installed and that the jupyter-notebook
command launches a Notebook. If not install Jupyter. Then to run, just launch jupyter-notebook
and choose K
as your Notebook type.