This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/python/yap_kernel/README.md

49 lines
1.6 KiB
Markdown
Raw Normal View History

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');
~~~~~~~~
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