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
add kernelspec for IPython 3.0 #210
Conversation
Why isn't this in |
I assumed it would be better not to run it while not all the detainls ( |
@Carreau, it probably won't get merged until it working and the IPython 3 spec is semi-finalized, so that's not an issue. |
Very excited for this. 😉 |
While we know the current form of the UI merged in ipython/ipython#6126 isn't ideal or final, it does get the job done. It would be great to get this merged into Julia so that we can start exposing Julia alongside Python and R in normal IPython/Jupyter installations. Is there anything we can do to help move this one forward? |
include("ipython.jl") | ||
const ipython, ipyvers = find_ipython() | ||
|
||
if ipyvers < v"3.0.0-dev" |
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.
Probably should be ipyvers < v"3.0-"
Get me time to implement the js loading part :-P. Will do soon. Envoyé de mon iPhone
|
mkpath(juliakspec) | ||
dest = joinpath(juliakspec, destname) | ||
|
||
|
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.
Probably add some info here:
eprintln("Writing IJulia kernel spec to $dest ...")
What needs to be done to get the tooltip and logo working? |
I'm just working on adding support for kernel logos - all you'll need to do is add a file to the kernel spec directory with a specific name. |
Thanks everyone for jumping in! Would love to have this working for some talks I'm giving in the next few weeks, including a keynote at PyCon Brazil in November. Let me know if there's anything I can do to help/test/etc. |
Part in IPython, mainly ipython/ipython#6354, at least the loading part, and discussing the unloading. @fperez woudl you mind doing demo from a branch ? I think I can have it working in less than 10 days, but I'm afraid of naming bikeshedding. |
Not october. That will probably be enough. I'm too much in a hurry to be in november :-P |
No, I don't mind demoing from a branch at all... THX!!! |
I merged that into |
eprintln("Writing IJulia kernelspec to $dest ...") | ||
|
||
open(dest, "w") do f | ||
write(f, JSON.json(ks)) |
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.
Did not found out how to indent the json in the kspec file though.
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.
Because you want it to be more human-readable?
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.
Yep, if you ever want to modify the kernelspec by hand :-) But I can leave it like that for time being.
Ok, I'm moving forward on IPython side with that. The good news is you will probably not need The bad news is that because of the Message Spec 4.0<->5.0 adapter, the tooltip will not work on functions with a bang in it, probably until IJulia speak 5.0 completely. |
Is this nearly ready to merge, then? |
I'll check that it works with the new compat macro. Envoyé de mon iPhone
|
"argv" => kernelcmd_array, | ||
"display_name" => "Julia", | ||
"language" => "julia", | ||
"codemirror_mode" => "julia" |
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.
Other pieces for the kernelspec, noted in ipython/ipython#6978:
"file_extension" => "jl"
"pygments_lexer" => "julia"
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.
We're actually putting those, along with language
and codemirror_mode
, in kernel_info_reply instead of the kernelspec. It's possible that the details will change again before release, but I doubt they'll go back into kernelspec.
Now that I'm installing and deploying Julia as part of an overall Jupyter demo, I'd like to help with this one (though I barely know any Julia). |
Side question, I see there is a
Seem much more readable than anything else. |
@Carreau, that could be filed as a Julia issue or discussed on julia-dev, but I suspect that introducing a distinct string type for paths is a big price to pay just to get a simplified notation for It would be quite reasonable to add: import Base./
(/)(a::AbstractString,b::AbstractString) = joinpath(a,b) in IJulia's |
Following this PR. Would probably then use this to get the Torch kernel to run with Jupyter. |
juliakspec = joinpath(chomp(readall(`$ipython locate`)),"kernels","julia") | ||
ks = @compat Dict( | ||
"argv" => kernelcmd_array, | ||
"display_name" => "Julia "*string(VERSION), |
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.
should add "language" => "julia"
There is still the limitation that object inspection will not work with identifiers that have a bang (!) in the name while IJulia does not support the kernelspec v5.
Updated and rebased on master. In conjunction with #276 should make IJulia work with IPython 3.0, either wether or not you use |
I'm super excited about this feature. |
Yeah, Someone a little more experienced than me should probably have a look at implementing message spec v5. That would allow to do some nifty things with completion like:
|
I'll merge it if you think it's ready to go. |
@@ -125,11 +138,55 @@ copy_config("ijuliafavicon.ico", | |||
# custom.js can contain custom js login that will be loaded | |||
# with the notebook to add info and/or monkey-patch some javascript | |||
# -- e.g. we use it to add .ipynb metadata that this is a Julia notebook | |||
copy_config("custom.js", joinpath(juliaprof, "static", "custom")) | |||
if ipyvers <= v"3.0-" |
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.
Why is there an if
statement here if both branches of the if
do the same thing?
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.
cause it's todo to remove on 3.0, but I can remove the if
.
add kernelspec for IPython 3.0
Thanks so much for your efforts on this, @Carreau. Now that it's merged, the people on the bleeding-edge IJulia can bang on it a little bit, and then I can tag a new release. |
Sure, I hope to find some time to do a bit more of Julia myself. Might demo On Thu, Feb 19, 2015 at 7:02 PM, Steven G. Johnson <notifications@github.com
|
Still WIP,But once ipython/ipython#6126 is merge this will allow to change running kernel in a single notebook server.This add the minimal changes necessary to register a new kernel with IPython.