diff --git a/packages/python/yap_kernel/README.md b/packages/python/yap_kernel/README.md index 9744da286..1878553e9 100644 --- a/packages/python/yap_kernel/README.md +++ b/packages/python/yap_kernel/README.md @@ -1,39 +1,48 @@ -# IPython Kernel for Jupyter +#YAP Kernel for Jupyter This package provides the IPython kernel for Jupyter. ## Installation from source -1. `git clone` -2. `cd ipykernel` -3. `pip install -e .` +This should install as part of the YAP system -After that, all normal `ipython` commands will use this newly-installed version of the kernel. +## Jupyter Lab -## Running tests +CodeMirror does not support highlighting for Prolog. YAP includes a +port based on one that is used in SWISH. To use this mode from +jupyter lab, do as follows: -Ensure you have `nosetests` and the `nose-warnings-filters` plugin installed with +1. run `jupyter lab build` (you may need root permission). Search the +output for a aline such as: -```bash -pip install nose nose-warnings-filters -``` +~~~~ +[LabBuildApp] > node /usr/local/lib/python3.7/site-packages/jupyterlab/staging/yarn.js install +~~~~ -and then from the root directory +2, Add the following 3 lines below to the webpack.config.js file: -```bash -nosetests ipykernel -``` +~~~~~~~ +fs.ensureDirSync('node_modules/codemirror/mode/prolog'); +fs.copySync(path.join(path.resolve(jlab.buildDir),'../../../kernels/yap_kernel/prolog.js'), 'node_modules/codemirror/mode/prolog/prolog.js'); +fs.copySync(path.join(path.resolve(jlab.buildDir),'../../../kernels/yap_kernel/meta.js'), 'node_modules/codemirror/mode/meta.js'); +~~~~~~~~ +These lines should copy YAP's prolog.js and a new version of the mode directory, meta.js. whenever you rebuild jlab, eg, if you add a new plugin. -## Running tests with coverage +Next, please check the lines in context. -Follow the instructions from `Running tests`. Ensure you have the `coverage` module installed with +be at around line 24: -```bash -pip install coverage -``` +~~~~~~~ + output: jlab.outputDir +}); -and then from the root directory +fs.ensureDirSync('node_modules/codemirror/mode/prolog'); +fs.copySync(path.join(path.resolve(jlab.buildDir),'../../../kernels/yap_kernel/prolog.js'), 'node_modules/codemirror/mode/prolog/prolog.js'); +fs.copySync(path.join(path.resolve(jlab.buildDir),'../../../kernels/yap_kernel/meta.js'), 'node_modules/codemirror/mode/meta.js'); + +// Create the entry point file. +var source = fs.readFileSync('index.js').toString(); +~~~~~~~~ + +3: Rerun "jupyter lab build" -```bash -nosetests --with-coverage --cover-package ipykernel ipykernel -```