Skip to content
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

Merged
merged 10 commits into from Feb 20, 2015
Merged

Conversation

Carreau
Copy link
Contributor

@Carreau Carreau commented Jul 26, 2014

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.


![capture decran 2014-07-26 a 22 43 23](https://cloud.githubusercontent.com/assets/335567/3712236/8a881e10-1505-11e4-8ecb-88739b503de0.png)

[edit] kernel selector is now in the `Kernel > change kernel` Menu. 

@stevengj
Copy link
Member

stevengj commented Aug 1, 2014

Why isn't this in deps/build.jl (or at least include-ed from there)? Shouldn't it be run automatically as part of installation if IPython 3 is detected in build.jl?

@Carreau Carreau self-assigned this Aug 2, 2014
@Carreau
Copy link
Contributor Author

Carreau commented Aug 2, 2014

I assumed it would be better not to run it while not all the detainls (custom.js, patching of Tooltip where sorted out), but I can move it into build.jl. It might take me quite some time with my computer dead and needed to reinstall everything though. I assign myself to think of doing it.

@stevengj
Copy link
Member

stevengj commented Aug 2, 2014

@Carreau, it probably won't get merged until it working and the IPython 3 spec is semi-finalized, so that's not an issue.

@rgbkrk
Copy link
Contributor

rgbkrk commented Sep 21, 2014

Very excited for this. 😉

@fperez
Copy link
Member

fperez commented Sep 24, 2014

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"
Copy link
Member

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-"

@Carreau
Copy link
Contributor Author

Carreau commented Sep 24, 2014

Get me time to implement the js loading part :-P. Will do soon.

Envoyé de mon iPhone

Le 24 sept. 2014 à 20:32, Fernando Perez notifications@github.com a écrit :

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?


Reply to this email directly or view it on GitHub.

mkpath(juliakspec)
dest = joinpath(juliakspec, destname)


Copy link
Member

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 ...")

@stevengj
Copy link
Member

What needs to be done to get the tooltip and logo working?

@takluyver
Copy link

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.

@fperez
Copy link
Member

fperez commented Sep 24, 2014

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.

@Carreau
Copy link
Contributor Author

Carreau commented Sep 24, 2014

What needs to be done to get the tooltip and logo working?

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.

@Carreau
Copy link
Contributor Author

Carreau commented Sep 24, 2014

November.

Not october. That will probably be enough. I'm too much in a hurry to be in november :-P

@fperez
Copy link
Member

fperez commented Sep 24, 2014

No, I don't mind demoing from a branch at all... THX!!!

@Carreau
Copy link
Contributor Author

Carreau commented Sep 25, 2014

I merged that into build.jl. Updating IJulia should detect recent enough ipython and install the kernelspec in that case.

eprintln("Writing IJulia kernelspec to $dest ...")

open(dest, "w") do f
write(f, JSON.json(ks))
Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

@Carreau
Copy link
Contributor Author

Carreau commented Oct 19, 2014

Ok, I'm moving forward on IPython side with that.

The good news is you will probably not need custom.js for your kernel at all.
You might still want one to change the favicon and logo maybe.

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.

@stevengj
Copy link
Member

Is this nearly ready to merge, then?

@Carreau
Copy link
Contributor Author

Carreau commented Oct 20, 2014

I'll check that it works with the new compat macro.
Also I think there are some issue with CodeMirror that does not recognize combining char, upstream was not patched, so I might need custom.js until next CodeMirror release after all.

Envoyé de mon iPhone

Le 20 oct. 2014 à 16:14, "Steven G. Johnson" notifications@github.com a écrit :

Is this ready to merge, then?


Reply to this email directly or view it on GitHub.

"argv" => kernelcmd_array,
"display_name" => "Julia",
"language" => "julia",
"codemirror_mode" => "julia"
Copy link
Contributor

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"

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.

@rgbkrk
Copy link
Contributor

rgbkrk commented Nov 24, 2014

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).

@Carreau
Copy link
Contributor Author

Carreau commented Dec 26, 2014

Side question, I see there is a path.jl and I suppose people are dealing with path a lot everywhere.
Why not a Path<:AbstractString that implement / = joinpath (= \ for windows ?) where if any of the LHS or RHS are Path coerce to Path ?

root/"user"/"something"/"something"

Seem much more readable than anything else.

@stevengj
Copy link
Member

@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 joinpath. Especially since you could always do (/)(a::AbstractString,b::AbstractString) = joinpath(a,b) if you really wanted to use this notation in your code (or use some other binary Unicode operator).

It would be quite reasonable to add:

import Base./
(/)(a::AbstractString,b::AbstractString) = joinpath(a,b)

in IJulia's build.jl, since we use joinpath a lot. This would simplify the code, and it would be fine with me if you want to incorporate it in your patch.

@rudimk
Copy link

rudimk commented Jan 16, 2015

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),
Copy link
Contributor

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.
@Carreau
Copy link
Contributor Author

Carreau commented Feb 17, 2015

Updated and rebased on master. In conjunction with #276 should make IJulia work with IPython 3.0, either wether or not you use --profile=julia.

capture d ecran 2015-02-17 a 15 17 53
capture d ecran 2015-02-17 a 15 17 12

@StefanKarpinski
Copy link
Sponsor Member

I'm super excited about this feature.

@Carreau
Copy link
Contributor Author

Carreau commented Feb 17, 2015

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:

atype)<tab> -> actually complete in front to function(atype) which would give the "seamless" tab introspection on doted accessors like in other languages, or whatever your kernel can do.

@stevengj
Copy link
Member

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-"
Copy link
Member

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?

Copy link
Contributor Author

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.

stevengj added a commit that referenced this pull request Feb 20, 2015
add kernelspec for IPython 3.0
@stevengj stevengj merged commit 6981f1b into JuliaLang:master Feb 20, 2015
@stevengj
Copy link
Member

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.

@Carreau
Copy link
Contributor Author

Carreau commented Feb 20, 2015

Sure, I hope to find some time to do a bit more of Julia myself. Might demo
that at Strata tomorrow. Thanks !

On Thu, Feb 19, 2015 at 7:02 PM, Steven G. Johnson <notifications@github.com

wrote:

Thanks so much for your efforts on this, @Carreau
https://github.com/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.


Reply to this email directly or view it on GitHub
#210 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants