Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Allow for additional tornado handlers in the notebook server #2694

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Contributor

filmor commented Dec 17, 2012

This makes the notebook server (at least for me) a bit more useful, since I can easily use the notebook's profile and provide a websocket-based service in the same context.

Owner

Carreau commented Dec 17, 2012

Out of curiosity, what are using in parallel ?

Contributor

filmor commented Dec 17, 2012

I've written a database connector that I expose using different python handlers via a tornado websocket. In the end I want to be able to write those handlers based on cells from notebooks.

Owner

Carreau commented Dec 19, 2012

Sorry for the delay to respond,
You want to connect cell to those db through websoket,
Is it to "store" those cells, to edit something ?
Can't you go through the kernel to do that?

I'm just trying to see how this could fit in IPython future plan, and in particular multi-user and security.
Or wether this already falls into the multiple backend to store things.

Contributor

filmor commented Dec 21, 2012

This maybe is a bit to hacky, point is, I want to run a specific IPython notebook server on the same port as some other applications (namely the database connector, that may also be used in Javascript widgets in the notebook itself for prototyping purposes). However what I just realised I would actually like to do would be to start a tornado server and use a notebook server as a handler for "/ipython/(.*)", by using a profile, i.e. I want to do something like ("ipython/(.*)", IPython.NotebookHandler(profile="nbserver")). This pull request emulates this behaviour by adding the other handlers to the notebook's tornado.

Owner

Carreau commented Dec 24, 2012

Ok, I'm not sure I totally follow,

serving under /ipython/* can be done with --NotebookApp.base_project_url but you want a handler for databases on the same port for your cells to access it.

I'm not quite sure of what you want to do with those handler. You state that you want to do it with javascript widget, but don't you want the js widget to acces this throught the kernel ? I do understand that for prototyping purpose this is usefull, but if we ship it, people will start relying on it for other purpose.

Isn't it possible to do the other way around ?
A proxy that will dispatch the request either to IPython if url start with 'ipython' or to any other program otherwise ?

If I had to guess, I would say nginx, or a simple node program.

If there is a positive answer I'm really interest in knowing how to do that for my own config. It's on the 1000 things I wan't to try and haven't got time to do.

Owner

ellisonbg commented Dec 24, 2012

Sorry for the delayed response. I won't have time to respond if full until
after Christmas, but I don't think we want to go in this direction. We
want IPython to be hackable and extensible, but have plans to accomplish
that in a different manner. More details to follow...

On Wed, Dec 19, 2012 at 10:43 AM, Bussonnier Matthias <
notifications@github.com> wrote:

Sorry for the delay to respond,
You want to connect cell to those db through websoket,
Is it to "store" those cells, to edit something ?
Can't you go through the kernel to do that?

I'm just trying to see how this could fit in IPython future plan, and in
particular multi-user and security.
Or wether this already falls into the multiple backend to store things.


Reply to this email directly or view it on GitHubhttps://github.com/ipython/ipython/pull/2694#issuecomment-11542305.

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

Owner

Carreau commented Dec 25, 2012

Not doable with nginx yet because of websocket, planed for 1.3.
Potentially doable with node, but there is a huge new bug in using base_project_url in current version that prevent from doing that.

Owner

Carreau commented Dec 30, 2012

@filmor

I did it with node

Mapped localhost:8000/ipython/* to localhost:8888/ipython/*
And at the same time localhost:8000/whatever/* to anotherhost:1234/somethingelse/*

Advantage is that you can change the bindings live without having to restart IPython notebook server.
(and works also with other programs than IPython)

Are you interested ?

Owner

ellisonbg commented Jan 9, 2013

So here is the rough outline of why we don't want to go in this direction. The current scope of the ipython notebook app is that it is the ipython notebook application. By, I mean that we want to limit its usefulness to serving notebooks only. Allowing arbitrary handlers turns the main notebook script into a sort of generic web framework that just happens to have an IPython notebook in it. That is too broad of a scope.

We do want people to write more general web applications that have notebooks in them, but these are outside the scope of ipython and should thus be done as separate projects. But, we do want to make it easy for people to write these notebook-including web apps. Some of the things we are thinking about:

  • Making our html/css/js more modular to allow people to grab only the pieces they need.
  • Refactoring our handlers to allow the same modularity.
  • Turning some of our main notebook app into libraries that other people can use.

Eventually, you should be able to grab the pieces you need, and create your own main web app script and be of to the races. BUT, I realize we are not there yet, so solutions like Matthias's node proxy are very attractive.

With these things in mind, are you OK if we close this PR?

Contributor

filmor commented Jan 10, 2013

I am indeed, thanks. I'll think I'll go with a proxy solution for now.

@filmor filmor closed this Jan 10, 2013

Owner

Carreau commented Jan 10, 2013

BTW, I released the proof of concept of proxy on npm and here is the source I'll be happy to get improvement.

Please ping me if you have issues using it.

Owner

ellisonbg commented Jan 10, 2013

@filmor thanks for understanding. Look forward to seeing how you end up using the notebook in your web apps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment