- Difficulty level: easy
- Time need to lean: 10 minutes or less
- Key points:
- Magic
%use NAME --language
can start a separate kernel withNAME
- Magic
%use NAME --language LAN --kernel KER
can bind a language module to an unsupported kernel - Option
--color
can be used to customize colored prompt of subkernels
- Magic
Components of subkernel
A subkernel consists of
- Name of subkernel, which is usually name of the language (e.g.
R
) - A Jupyter kernel (e.g.
irkernel
for language R - A SoS language module (e.g.
sos-r
for R - A color used to color the input prompt
A subkernel will be started with the execution of a cell with the selected language. By default
- The name of the subkernel is the name of the language
- The Jupyter kernel for the language. If multiple kernels that support the same language are available, preference will be given to a kernel determined by SoS.
- The SoS language module for the selected language.
- A default color determined by SoS.
For example, the following cell starts subkernel Python3
, with language Python3
, kernel ipython
, language module sos-python
, and a default color determined by SoS.
Using the %use
magic, you can start another session of the same language by specifying a separate subkernel with language name specified with option --language
. A separate color is usually specified to differentiate two subkernels:
As you can see, the two Python3 kernels do not share variables:
And you can transfer variables from one kernel to another as usual:
Each language module supports one or more kerneles (e.g. kernel javascript
, and nodejs
for JavaScript) for one or more langauges (e.g. both MATLAB
and Octave
are supported by the sos-matlab
langauge module). If there is a kernel that uses one of the supported languages but is not explicitly supported by SoS, you can use the --kernel
option in combination with the --language
option to link the kernel with the specific language module.
For example, if you have developed yet another kernel for javascript, you can link it with the sos-javascript
language module with command
%use myjs --kernel myjs --language JavaScript