2019-03-19 20:13:21 +00:00
|
|
|
#YAP Kernel for Jupyter
|
2017-05-14 11:27:44 +01:00
|
|
|
|
|
|
|
This package provides the IPython kernel for Jupyter.
|
|
|
|
|
|
|
|
## Installation from source
|
|
|
|
|
2019-03-19 20:13:21 +00:00
|
|
|
This should install as part of the YAP system
|
2017-05-14 11:27:44 +01:00
|
|
|
|
2019-03-19 20:13:21 +00:00
|
|
|
## Jupyter Lab
|
2017-05-14 11:27:44 +01:00
|
|
|
|
2019-03-19 20:13:21 +00:00
|
|
|
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:
|
2017-05-14 11:27:44 +01:00
|
|
|
|
2019-03-19 20:13:21 +00:00
|
|
|
1. run `jupyter lab build` (you may need root permission). Search the
|
|
|
|
output for a aline such as:
|
2017-05-14 11:27:44 +01:00
|
|
|
|
2019-03-19 20:13:21 +00:00
|
|
|
~~~~
|
|
|
|
[LabBuildApp] > node /usr/local/lib/python3.7/site-packages/jupyterlab/staging/yarn.js install
|
|
|
|
~~~~
|
2017-05-14 11:27:44 +01:00
|
|
|
|
2019-03-19 20:13:21 +00:00
|
|
|
2, Add the following 3 lines below to the webpack.config.js file:
|
2017-05-14 11:27:44 +01:00
|
|
|
|
2019-03-19 20:13:21 +00:00
|
|
|
~~~~~~~
|
|
|
|
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');
|
2019-03-20 10:52:38 +00:00
|
|
|
..~~~~~~~~
|
2019-03-19 20:13:21 +00:00
|
|
|
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.
|
2017-05-14 11:27:44 +01:00
|
|
|
|
2019-03-19 20:13:21 +00:00
|
|
|
Next, please check the lines in context.
|
2017-05-14 11:27:44 +01:00
|
|
|
|
2019-03-19 20:13:21 +00:00
|
|
|
be at around line 24:
|
2017-05-14 11:27:44 +01:00
|
|
|
|
2019-03-19 20:13:21 +00:00
|
|
|
~~~~~~~
|
|
|
|
output: jlab.outputDir
|
|
|
|
});
|
2017-05-14 11:27:44 +01:00
|
|
|
|
2019-03-19 20:13:21 +00:00
|
|
|
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"
|
2017-05-14 11:27:44 +01:00
|
|
|
|