New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
caching available kernels into config #177
Conversation
|
||
updateKernels: -> | ||
save = (out) => | ||
@availableKernels = _.pluck JSON.parse(out).kernelspecs, 'spec' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSON.parse(out)
throws because out
is not valid JSON when using IPython v1.2.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we need tooling for upgrading from old specs to new specs, though I think it can be a follow on PR after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about guarding with a try/catch
block?
save = (out) =>
try
@availableKernels = _.pluck JSON.parse(out).kernelspecs, 'spec'
@setConfigJson 'kernelspecs', @availableKernels
atom.notifications.addInfo 'Hydrogen Kernels updated:',
detail: (_.pluck @availableKernels, 'display_name').join('\n')
catch
Also you need to update module.exports = Hydrogen =
config:
kernelspecs:
title: "Kernel Specs"
description: 'Kernel specs as reported by:
$ jupyter kernelspecs list --json
E.g.:
{
"ijavascript": {
"spec": {
"display_name": "IJavascript",
"env": {},
"argv": [
"node",
"/home/user/node_modules/ijavascript/lib/kernel.js",
"--protocol=5.0",
"{connection_file}"
],
"language": "javascript"
},
"resources_dir": "/home/user/node_modules/ijavascript/images"
}
}'
type: 'string'
default: '{}' |
e8e8351
to
152e42e
Compare
As a user, I don't want to type my custom kernelspecs every time I launch Atom. I think if a user defines manually the kernel specs, Hydrogen shouldn't delete the user's settings. |
@n-riesco And it wouldn't. If you have non working ipython kernelspec and jupyter kernelspec, it would use your kernelspec option. |
This commit is not working for me. |
I don't understand the logic here. If we don't return, |
Why is the setting PS: Does anyone know where atom stores the settings? |
That typos were for my debug purposes. And I left them - my fault
Because it's an output of kernelspec command, which contain kernelspecs property. |
#38 |
PS: Does anyone know where atom stores the settings? /home/user/.atom/config.cson |
@slavaGanzin I disagree on #38 (we shouldn't force users to install IPython to use Hydrogen, specially users of languages other than Python).
Connection files represent actual connections (they don't define a kernel spec). |
https://jupyter-client.readthedocs.org/en/latest/kernels.html#kernel-specs |
This line is causing the save stdout unless e |
I reckon this line should be: kernels = _.pluck @getConfigJson('kernelspec', {kernelspecs:{}}).kernelspecs, 'spec' |
I rewrite a bit and now it's guarded with: it can't be |
That's not my point. Ideally, there shouldn't be any need for Hydrogen users to install Jupyter or IPython. The current state of Hydrogen is that either a recent version of Previous versions of Hydrogen used to work on a box with IPython 1.2.1 (as long as the kernel specs were installed in one of the locations known to Hydrogen). When I reported #173 , I was hoping to find a friendly compromise. I'm not asking to stop using the newer versions. What I'm asking is that we write robust code (i.e. doesn't throw uncaught exceptions) and that allows Hydrogen to run in a standard Ubuntu 14.04 box. |
I've tested the latest commits and it's working in my machine. |
What would you say our version bump is here? |
caching available kernels into config
@rgbkrk I haven't followed some of the latest commits, so I can't answer your question. But I would suggest that:
|
0.7.1 |
Great, done! 🎉
|
No description provided.