Calysto / metakernel

Jupyter/IPython Kernel Tools
BSD 3-Clause "New" or "Revised" License
347 stars 84 forks source link

kernel_javascript writes kernel.js to kernelspec #194

Open brainysmurf opened 5 years ago

brainysmurf commented 5 years ago

This way you can write kernel.js the same way we write the kernel.json, for say, a syntax highlighter:

class MyKernel(Metakernel):
    kernel_javascript = """
define(
['codemirror/lib/codemirror', 'codemirror/addon/mode/simple'],
function(CodeMirror, _) {
  return {
    onload: function(){
        CodeMirror.defineSimpleMode('language_name', {
            start: [
                // defs here
            ]
        });
    }
  };
});
"""

    kernel_json = {
        'argv': [
            sys.executable, '-m', 'module_name', '-f', '{connection_file}'],
        'display_name': 'Name of Kernel',
        'language': 'language_name',
        'name': 'name_of_kernel'
    }
coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.08%) to 75.867% when pulling 00d1eb4ccca1c435672d5b7631d3c37f26a4b0e4 on brainysmurf:javascript into f16faf5ff4410ef0c52dff45c64249c72db52197 on Calysto:master.

dsblank commented 4 years ago

Thanks! This makes sense. Could you document this in the README or other place in the instructions where people might find it?

ohAitch commented 1 year ago

hah nice, I was in the process of writing up an essentially identical PR! Re: documentation, where is "here's how you configure kernel_json" currently located? Seems like it would be the right place for it.