n-riesco / ijavascript

IJavascript is a javascript kernel for the Jupyter notebook
Other
2.18k stars 187 forks source link

How to disable 'undefined' output #96

Closed thisroot closed 7 years ago

thisroot commented 7 years ago

Hi, wonderful library, but it is very annoying 'undefined' output, is it possible to remove its?

n-riesco commented 7 years ago

There is a command flag for that: --ijs-hide-undefined. To get a list of all the IJavascript flags, run: ijs --ijs-help.

thisroot commented 7 years ago

Thanks!

thisroot commented 7 years ago

How it's use from jupyter notebook?

n-riesco commented 7 years ago

@thisroot Did you try to run ijs --ijs-hide-undefined?

rgbkrk commented 7 years ago

@n-riesco it sounds like the question is how to configure the kernel.json to have this option so it comes up from the same notebook server as people use for Python.

n-riesco commented 7 years ago

@thisroot @rgbkrk

I'm using something like this to test Hydrogen:

"kernelspecs": {
    "ijavascript": {
        "spec": {
            "display_name": "IJavascript",
            "env": {},
            "argv": [
                "ijskernel",
                "--hide-undefined",
                "--protocol=5.0",
                "{connection_file}"
            ],
            "language": "javascript"
        },
        "resources_dir": "/home/user/lib/node_modules/ijavascript/images"
    }
}
rgbkrk commented 7 years ago

@thisroot run jupyter kernelspec list. You'll see output like:

  javascript      /Users/kylek/Library/Jupyter/kernels/javascript

Edit /Users/kylek/Library/Jupyter/kernels/javascript/kernel.json (append kernel.json to the path above for the javascript entry).

{
  "argv": [
    "ijskernel",
    "--hide-undefined",
    "{connection_file}",
    "--protocol=5.0"
  ],
  "display_name": "Javascript (Node.js)",
  "language": "javascript"
}

For what it's worth, I prefer hiding undefined by default as well.

n-riesco commented 7 years ago

@rgbkrk There shouldn't be any need for editing the kernel spec. This should happen automatically when you run ijs --ijs-hide-undefined.


There are several open issues that have highlighted that the original purpose of ijs as a wrapper around jupyter notebook is dated and confusing.

To address this confusion and acknowledge the three main use-cases of IJavascript, I'm planning to introduce the commands ijsinstall, ijsconsole and ijsnotebook.

rgbkrk commented 7 years ago

I never run ijs and never will -- I want to use the kernel on jupyter servers running remotely (where it gets orchestrated as jupyter notebook). Kernels shouldn't have to run the server their own way -- they should work out of the box in jupyter, qtconsole, nteract, etc.