<div dir="ltr">Thanks Brian, the sketch gives us a good idea for our path.<br></div><div class="gmail_extra"><br clear="all"><div><br>Jason<br><a href="http://moorepants.info" target="_blank">moorepants.info</a><br><span>+01 530-601-9791</span><br>

</div>
<br><br><div class="gmail_quote">On Sun, Jun 16, 2013 at 9:51 PM, Brian Granger <span dir="ltr"><<a href="mailto:ellisonbg@gmail.com" target="_blank">ellisonbg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Jason,<br>
<div class="im"><br>
> That is exactly what I wanted to hear. I'm just looking for some clarity on<br>
> how IPython works, how our project can utilize it, and where our resources<br>
> can potentially help you all. I agree firmly with sound design before<br>
> writing code and am glad to here you all are committed to that. Thanks!<br>
<br>
</div>Thanks for understanding, glad my comments helped you.<br>
<div class="im"><br>
> So the better question for you all may be this:<br>
><br>
> We're developing some browser based visualizations that we will use a simple<br>
> web server, a socket, or writing js on the fly to communicate between our<br>
> Python packages and the JS libraries. We'd love to design this in a way that<br>
> we can display the same thing in a notebook cell. Right now we can do that<br>
> with the ipython Display mechanisms but the data flow is definitely a hack.<br>
> What would be your recommendation for our approach so that (1) we can<br>
> display our visualization in the notebook now but without investing tons of<br>
> time into code that will be useless once you all have the widget support and<br>
> (2) that our designs be intended to mesh with the future JS widget designs<br>
> for the notebook (i.e. that our design is agnostic to the display mechanism<br>
> in the browser)?<br>
<br>
</div>Here is a sketch of the some of the major features of the new design:<br>
<br>
* We will create an API that allows Python and JS to communicate data<br>
back and forth using JSON.  The JSON data might be the data you want<br>
to visualize.<br>
* When data is sent back and forth, a handler will be declared for<br>
that data.  There will likely be handlers on both the JS and Python<br>
sides.  These handlers will consume the JSON data and do whatever<br>
needs to be done.<br>
* We want to move away from having to write "code in strings" that is<br>
passed to Kernel.execute or the Javascript object.  The handler names<br>
will be used instead.<br>
* We expect the current Javascript display object to continue to work though.<br>
<br>
So, if you can work to cleanly separate your JS code from the JSON<br>
data that goes back and forth, you should have a clean path for the<br>
transition.<br>
<div class="im"><br>
> And a secondary question, what's the best way for us to follow progress in<br>
> the ipython js developments. Is the roadmap wiki the best place for the<br>
> looking for sumarized info on these parts of the project?<br>
<br>
</div>The roadmap is pretty good, but we will probably also have other<br>
design documents on the wiki just for the interactive widgets.  I<br>
would check back in early August and we will have a lot more to say.<br>
We will also send out requests for comments on ipython-dev during the<br>
design and implementation process.<br>
<br>
Looking forward to see what you are all up to...<br>
<br>
Cheers,<br>
<br>
Brian<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> Jason<br>
> <a href="http://moorepants.info" target="_blank">moorepants.info</a><br>
> +01 <a href="tel:530-601-9791" value="+15306019791">530-601-9791</a><br>
><br>
><br>
> On Sat, Jun 15, 2013 at 9:44 AM, Brian Granger <<a href="mailto:ellisonbg@gmail.com">ellisonbg@gmail.com</a>> wrote:<br>
>><br>
>> I don't think you are going to like this, but I want to be honest<br>
>> about our situation wrt these things:<br>
>><br>
>> * It is not supported to do direct calls from the browser to the<br>
>> kernel.  You can hack it, but in general there is no promise the<br>
>> kernel is even running on publicly visible host.  Personally I would<br>
>> not invest the time to do direct GET/POST to the kernel.<br>
>> * If you write the data to a file, you can load the data using URLs of<br>
>> the form "files/mydata.json".<br>
>> * There is no way for JS to directly write data to a file.  You will<br>
>> have to embed the data in the string passed to Kernel.execute.<br>
>> * If you really have to work on all of this during the summer, it is<br>
>> going to be somewhat painful and you will have to redo a good part of<br>
>> it once IPython's support improves later this year.  If it were me, I<br>
>> would focus on other things.  This type of thing should be *trivial*<br>
>> once we have done our work.<br>
>> * We will *start* on this in late summer, but the work will be done<br>
>> gradually between late summer and early next year.  But, the low level<br>
>> pieces that you probably need should be done by Fall.<br>
>> * We are committed to getting the design of these things right.<br>
>> Within the IPython code base we are strictly focused on our 1.0<br>
>> release and roadmap:<br>
>><br>
>> <a href="https://github.com/ipython/ipython/wiki/Roadmap:-IPython" target="_blank">https://github.com/ipython/ipython/wiki/Roadmap:-IPython</a><br>
>><br>
>> * This means we are actually committed to *not* doing anything on the<br>
>> interactive widgets within IPython until late Fall.  Even if other<br>
>> people want to contribute to the code base for these things, it will<br>
>> be ignored.  It is not a matter of writing code - that is the easy<br>
>> part - the hard part is the design.  IPython is a big project and it<br>
>> is extremely important for us to be focused, otherwise the project<br>
>> starts to look like a random walk and progress on big things is<br>
>> difficult.  Until later summer our focus is on nbconvert,<br>
>> multidirectory support and the 1.0 release.<br>
>> * IPython has been in this situation multiple times before - IOW<br>
>> people waiting long periods of time for us to finish important work.<br>
>> In all cases, waiting and being patient has been the right thing to<br>
>> do.<br>
>><br>
>> I know this is probably bad news, but in the end, if you simply wait<br>
>> you will be able to accomplish what you want with a smile on your face<br>
>> saying "wow, I can't believe how awesome and easy this is...just<br>
>> magic"<br>
>><br>
>> Cheers,<br>
>><br>
>> Brian<br>
>><br>
>> On Sat, Jun 15, 2013 at 9:23 AM, Jason Moore <<a href="mailto:moorepants@gmail.com">moorepants@gmail.com</a>> wrote:<br>
>> > Brian,<br>
>> ><br>
>> > So it seems that for us to get some data from a python object into our<br>
>> > javascript, we write the data to file on the fly so that a js cell can<br>
>> > pull<br>
>> > it in from the filesystem or we hard code the data into the js string.<br>
>> > Is<br>
>> > that the way it should be done with the current setup?<br>
>> ><br>
>> > So we'd like the functionality for GET/POST in the notebook for our<br>
>> > project.<br>
>> > And I have one full time student that starts this week. What would be<br>
>> > the<br>
>> > best way for us to contribute some patches to jumpstart this on the<br>
>> > ipython<br>
>> > side?<br>
>> ><br>
>> ><br>
>> ><br>
>> > Jason<br>
>> > <a href="http://moorepants.info" target="_blank">moorepants.info</a><br>
>> > +01 <a href="tel:530-601-9791" value="+15306019791">530-601-9791</a><br>
>> ><br>
>> ><br>
>> > On Sat, Jun 15, 2013 at 9:02 AM, Brian Granger <<a href="mailto:ellisonbg@gmail.com">ellisonbg@gmail.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> Right now it does not have any easy way of doing that.  For now you<br>
>> >> will have to encode your data into the call to kernel.execute, which<br>
>> >> is a completely pain. That is exactly what we will be tackling later<br>
>> >> in the summer...<br>
>> >><br>
>> >> Cheers,<br>
>> >><br>
>> >> Brian<br>
>> >><br>
>> >> On Sat, Jun 15, 2013 at 8:54 AM, Jason Moore <<a href="mailto:moorepants@gmail.com">moorepants@gmail.com</a>><br>
>> >> wrote:<br>
>> >> > Brian,<br>
>> >> ><br>
>> >> > In IPython, is there a standard mechanism to pass data from the<br>
>> >> > client<br>
>> >> > to<br>
>> >> > the server? We'd like to make some python calls that generate a data<br>
>> >> > stucture, jsonify it and then make it available to the javascript<br>
>> >> > that<br>
>> >> > is<br>
>> >> > running in a cell via a GET request. I assume the kernel architecture<br>
>> >> > has<br>
>> >> > this in place?<br>
>> >> ><br>
>> >> ><br>
>> >> > Jason<br>
>> >> > <a href="http://moorepants.info" target="_blank">moorepants.info</a><br>
>> >> > +01 <a href="tel:530-601-9791" value="+15306019791">530-601-9791</a><br>
>> >> ><br>
>> >> ><br>
>> >> > On Sat, Jun 15, 2013 at 8:14 AM, Brian Granger <<a href="mailto:ellisonbg@gmail.com">ellisonbg@gmail.com</a>><br>
>> >> > wrote:<br>
>> >> >><br>
>> >> >> Right now (today) the best way is to use the Javascript object along<br>
>> >> >> with the display function.  However, starting in late summer we will<br>
>> >> >> be improving this API so it may change some, but all for the<br>
>> >> >> better...<br>
>> >> >><br>
>> >> >> Cheers,<br>
>> >> >><br>
>> >> >> Brian<br>
>> >> >><br>
>> >> >> On Fri, Jun 14, 2013 at 11:33 PM, TARUN GABA <<a href="mailto:tarun.gaba7@gmail.com">tarun.gaba7@gmail.com</a>><br>
>> >> >> wrote:<br>
>> >> >> > Hi,<br>
>> >> >> ><br>
>> >> >> > I am wondering on what method would be more efficient to serve<br>
>> >> >> > Javascripts on IPython notebooks<br>
>> >> >> ><br>
>> >> >> > I need to visualize/simulate multibody dynamics, and there are two<br>
>> >> >> > methods which are in my mind.<br>
>> >> >> > The rough API of the project is being formed at ..<br>
>> >> >> ><br>
>> >> >> > <a href="http://pydy.org/visualization" target="_blank">http://pydy.org/visualization</a><br>
>> >> >> ><br>
>> >> >> > the two methods are:<br>
>> >> >> > 1) Via http requests:<br>
>> >> >> ><br>
>> >> >> >   on calling something like ..<br>
>> >> >> ><br>
>> >> >> > myobject.visualize(numerical_data)<br>
>> >> >> ><br>
>> >> >> > The browser sends a POST request to the kernel, and python methods<br>
>> >> >> > send a POST request to the required javascripts alongwith POST<br>
>> >> >> > parameters as the numerical data required for visualization, most<br>
>> >> >> > likely a 4*4 transformation matrix, and shape information.<br>
>> >> >> > the Javascripts recieves the post and then it is displayed in the<br>
>> >> >> > IPython output cell.<br>
>> >> >> ><br>
>> >> >> > 2) Another method can be to make Javascript objects and save them<br>
>> >> >> > as<br>
>> >> >> > text in the classes,<br>
>> >> >> > something like ..<br>
>> >> >> ><br>
>> >> >> > def MyClass():<br>
>> >> >> ><br>
>> >> >> >     def __init__(relevant,args):<br>
>> >> >> >         self.js_data = ''' A call to the Javascript functions,<br>
>> >> >> > alongwith arguments..<br>
>> >> >> >                              var myobject =<br>
>> >> >> > Shape_creating_function(%s)'''%(args)<br>
>> >> >> ><br>
>> >> >> > and then on calling ..<br>
>> >> >> > MyClass.visualize()<br>
>> >> >> ><br>
>> >> >> > from IPython notebook, first calling all the required<br>
>> >> >> > javascripts(files) via publish_javascript()/publish_html() display<br>
>> >> >> > methods and then<br>
>> >> >> ><br>
>> >> >> > display(Javascript(MyClass.js_data))<br>
>> >> >> ><br>
>> >> >> > Which of these would be more feasible and efficient..<br>
>> >> >> > _______________________________________________<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>
>> >> >><br>
>> >> >><br>
>> >> >><br>
>> >> >> --<br>
>> >> >> Brian E. Granger<br>
>> >> >> Cal Poly State University, San Luis Obispo<br>
>> >> >> <a href="mailto:bgranger@calpoly.edu">bgranger@calpoly.edu</a> and <a href="mailto:ellisonbg@gmail.com">ellisonbg@gmail.com</a><br>
>> >> >> _______________________________________________<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>
>> >> ><br>
>> >> ><br>
>> >> ><br>
>> >> > _______________________________________________<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>
>> >> ><br>
>> >><br>
>> >><br>
>> >><br>
>> >> --<br>
>> >> Brian E. Granger<br>
>> >> Cal Poly State University, San Luis Obispo<br>
>> >> <a href="mailto:bgranger@calpoly.edu">bgranger@calpoly.edu</a> and <a href="mailto:ellisonbg@gmail.com">ellisonbg@gmail.com</a><br>
>> >> _______________________________________________<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>
>> ><br>
>> ><br>
>> ><br>
>> > _______________________________________________<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>
>> ><br>
>><br>
>><br>
>><br>
>> --<br>
>> Brian E. Granger<br>
>> Cal Poly State University, San Luis Obispo<br>
>> <a href="mailto:bgranger@calpoly.edu">bgranger@calpoly.edu</a> and <a href="mailto:ellisonbg@gmail.com">ellisonbg@gmail.com</a><br>
>> _______________________________________________<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>
><br>
><br>
><br>
> _______________________________________________<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>
><br>
<br>
<br>
<br>
--<br>
Brian E. Granger<br>
Cal Poly State University, San Luis Obispo<br>
<a href="mailto:bgranger@calpoly.edu">bgranger@calpoly.edu</a> and <a href="mailto:ellisonbg@gmail.com">ellisonbg@gmail.com</a><br>
_______________________________________________<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>