A Jupyter kernel base class in Python which includes core magic functions (including help, command and file path completion, parallel and distributed processing, downloads, and much more).
See Jupyter's docs on wrapper kernels.
Additional magics can be installed within the new kernel package under a magics subpackage.
- Basic set of line and cell magics for all kernels.
-
- Python magic for accessing python interpreter.
- Run kernels in parallel.
- Shell magics.
- Classroom management magics.
- Tab completion for magics and file paths.
- Help for magics using ? or Shift+Tab.
- Plot magic for setting default plot behavior.
- matlab_kernel, https://github.com/Calysto/matlab_kernel
- octave_kernel, https://github.com/Calysto/octave_kernel
- calysto_scheme, https://github.com/Calysto/calysto_scheme
- calysto_processing, https://github.com/Calysto/calysto_processing
- java9_kernel, https://github.com/Bachmann1234/java9_kernel
- xonsh_kernel, https://github.com/Calysto/xonsh_kernel
- calysto_hy, https://github.com/Calysto/calysto_hy
- gnuplot_kernel, https://github.com/has2k1/gnuplot_kernel
- spylon_kernel, https://github.com/mariusvniekerk/spylon-kernel
- wolfram_kernel, https://github.com/mmatera/iwolfram
- sas_kernel, https://github.com/sassoftware/sas_kernel
- pysysh_kernel, https://github.com/Jaesin/psysh_kernel
- calysto_bash, https://github.com/Calysto/calysto_bash
... and many others.
You can install Metakernel through pip
:
Installing metakernel from the conda-forge channel can be achieved by adding conda-forge to your channels with:
Once the conda-forge channel has been enabled, metakernel can be installed with:
It is possible to list all of the versions of metakernel available on your platform with:
Although MetaKernel is a system for building new kernels, you can use a subset of the magics in the IPython kernel.
Put the following in your (or a system-wide) ipython_config.py
file:
Use MetaKernel Languages in Parallel
To use a MetaKernel language in parallel, do the following:
- Make sure that the Python module ipyparallel is installed. In the shell, type:
- To enable the extension in the notebook, in the shell, type:
- To start up a cluster, with 10 nodes, on a local IP address, in the shell, type:
- Initialize the code to use the 10 nodes, inside the notebook from a host kernel
MODULE
andCLASSNAME
(can be any metakernel kernel):
For example:
- Run code in parallel, inside the notebook, type:
Execute a single line, in parallel:
Or execute the entire cell, in parallel:
Results come back in a Python list (Scheme vector), in cluster_rank
order. (This will be a JSON representation in the future).
Therefore, the above would produce the result:
You can get the results back in any of the parallel magics (%px
, %%px
, or %pmap
) in the host kernel by accessing the variable _
(single underscore), or by using the --set_variable VARIABLE
flag, like so:
Then, in the next cell, you can access results
.
Notice that you can use the variable cluster_rank
to partition parts of a problem so that each node is working on something different.
In the examples above, use -e
to evaluate the code in the host kernel as well. Note that cluster_rank
is not defined on the host machine, and that this assumes the host kernel is the same as the parallel machines.
Metakernel
subclasses can be configured by the user. The configuration file name is determined by the app_name
property of the subclass. For example, in the Octave
kernel, it is octave_kernel
. The user of the kernel can add an octave_kernel_config.py
file to their jupyter
config path. The base MetaKernel
class offers plot_settings
as a configurable trait. Subclasses can define other traits that they wish to make configurable.
As an example:
Example notebooks can be viewed here.
Documentation is available online. Magics have interactive help (and online).
For version information, see the Changelog.