<div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 24, 2012 at 10:42, Ralf Hemmecke <span dir="ltr"><<a href="mailto:hemmecke@gmail.com" target="_blank">hemmecke@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Thank you, Fernando.<br>
<div class="im"><br>
>> Is the notebook suited for this purpose or is it too much tied to<br>
>> python?<br>
><br>
> Indeed, it would be possible to do so; recently an enterprising user<br>
> did just that as a test with Ruby:<br>
><br>
> <a href="https://github.com/isotope11/iruby" target="_blank">https://github.com/isotope11/iruby</a><br>
<br>
</div> From what I figured out so far, but Josh Adams modified ipython<br>
(<a href="https://github.com/isotope11/ipython/tree/ruby_kernel" target="_blank">https://github.com/isotope11/ipython/tree/ruby_kernel</a>) in order to<br>
start ruby. <br></blockquote><div><br></div><div>The *only* modification he needed to make to IPython was to change the CodeMirror language to Ruby.</div><div>The rest was just subclassing and configuration.</div><div><br>

</div><div>> Not that I understood everything, I wonder why ipython does not include such kind of talking to an external interpreter.</div></div><div class="gmail_quote"><br><div>IPython does not include kernels in a dozen other languages because each one must have an implementation of the kernel.</div>

<div><br></div><div>There are two ways to implement a new kernel:</div><div><br></div><div>1. translate the existing kernel into the target language. This would have to include complying with message spec and serialization, etc.</div>

<div>2. subclass existing Kernel, to call out to a subprocess for execution.  This would save a lot of work, particularly if all you want to do is simple stdin/stdout, but would be inefficient, as it adds yet another process/network hop to the mix, and only appropriate for supporting languages that don't do much interactively.</div>

<div><br></div><div>This is all work that has to be done, and it is work that is going to be done by people who want to use these other languages in the notebook (i.e. not IPython devs). We are happy to help contributors with this work, but it will not be us who write it.</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> Unfortunately we haven't had the time to write a detailed design<br>
> document that explains how the entire architecture works for someone<br>
> in your position.<br>
<br>
</div>Understandable, but may I still ask for the big picture.<br>
Let me guess.<br>
<br>
(a) The client side is done with JavaScript. This is responsible for<br>
code highlighting, tab completion and what not.<br></blockquote><div><br></div><div>correct</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
(b) JavaScript is probably talking (via 0MQ) to some python process on<br>
the server in order to get information of what to highlight and what to<br>
complete<br></blockquote><div><br></div><div>Close: js talks websockets, which are translated to zmq by the nb server.</div><div><br></div><div>Completion is handled in the kernel, but highlighting is purely js (CodeMirror).</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
(c) The input string is sent (probably in json format) to the server.<br>
<br>
(d) The server sends a json format of the output back to the client.<br>
<br>
Of course, I want different highlighting. Which function is responsible<br>
for that? How (for simplicity) could I simply switch that off?<br></blockquote><div><br></div><div>Highlighting is done by CodeMirror, and the language is selected <a href="https://github.com/ipython/ipython/blob/master/IPython/frontend/html/notebook/static/js/codecell.js#L40">here</a>.</div>

<div>We have not exposed UI to change the highlighting language, but it</div><div>wouldn't be difficult.  If your language is not already supported by CodeMirror,</div><div>I think you have to add the highlighting spec.</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Same question for completion.<br>
<br>
I have to start an external process (fricas in my case) and send input<br>
to it and receive its output. Which functions are responsible for that?<br></blockquote><div><br></div><div>The launch_kernel function in a KernelManager</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div class="im"><br>
> So I'm afraid that making progress will require a fair amount of<br>
> reading the source and experimenting.  But don't be afraid to ask<br>
> here!<br>
<br>
</div>If I don't disturb people here too much...<br>
What I don't see at the moment is in how far the notebook is tied to<br>
python. In some .ipynb file, I've seen "language: python" which seemed<br>
to be connected to one cell. That made me wonder whether you've already<br>
thought about having an input cell in another language. Since I would<br>
have to add the fricas language, where would I do this?<br></blockquote><div><br></div><div>This code would be *entirely* in the javascript - it's just a metadata field on the Cell,</div><div>and it would only be a few lines to make it editable.</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
>> From our perspective, this is *absolutely* something we'd like to<br>
>> see out there.<br>
<br>
</div>That's good. At least it sounds like I will be going a supported path.<br>
<div class="im"><br>
> Just today I was talking to a statistician friend and we were<br>
> discussing the possibility of an R notebook frontend.  That's also<br>
> something that would be great to have, and likely very useful.<br>
<br>
</div>Yep. In fact, it would be wonderful, if one could have a multi-language<br>
environment in one notebook. The SageNotebook has something like this,<br>
but it cannot currently run without Sage and I am actually looking for<br>
something lighter.<br>
<br>
BTW, I installed ipython into a virtualenv. However, I was unable to get<br>
it running with ZeroMQ installed in my HOME. I would be grateful, if I<br>
can learn about installing ipython with with ZeroMQ not under /usr/local.<br></blockquote><div><br></div><div>This should be easy, just configure zeromq with the virtualenv prefix (or any other prefix, for that matter):</div>

<div><br></div>version=2.1.11<br><br>curl -O <a href="http://download.zeromq.org/zeromq-$version.tar.gz">http://download.zeromq.org/zeromq-$version.tar.gz</a><br>tar -xzf zeromq-$version.tar.gz<br>cd zeromq-$version<br>./configure --prefix=$VIRTUAL_ENV<br>

make && make install<br><br># and install pyzmq, ensuring it knows where to look for libzmq:<br><br></div><div class="gmail_quote">pip install pyzmq --install-option="--zmq=$VIRTUAL_ENV"</div><div class="gmail_quote">

<br>-MinRK<br><br><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Regards<br>
<span class="HOEnZb"><font color="#888888">Ralf<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</div></div></blockquote></div><br></div>