r/Python • u/mangecoeur • Apr 22 '14
IPython Notebook for Desktop - a first version [x-post IPython]
https://github.com/mangecoeur/ipython-desktop3
u/cw2P Apr 23 '14
Is there a reason why this is implemented in node / javascript instead of python? Seems silly to have to have another interpreter installed to use it.
6
Apr 23 '14
It's implemented in Node/Javascript because it leverages node-webkit, which allows you to package a "website" as a native app so that it runs in its own chromeless browser window with filesystem access and several other useful features. Normally, the project would provide native executables for Windows/Linux/Mac which would not require Node.js to be installed, but it looks like the author of this project hasn't gotten around to that yet.
I'm not sure if there's anything similar to node-webkit in Python. I've hacked up some chromeless browser windows using PyQt before, but it would take a reasonable amount of effort on top of that to duplicate what node-webkit does.
(Disclaimer: Not affiliated with ipython-desktop at all.)
2
u/Widdershiny Apr 23 '14
I'm not sure if there's anything similar to node-webkit in Python.
I made something for this purpose, WebUI. It's a very thin wrapper around PySide, and I built it around Flask. It's not very feature rich or anything, but it does work.
4
u/mangecoeur Apr 23 '14
I was actully looking for something like this, there's also pythonwebkit - http://www.gnu.org/software/pythonwebkit/
But node-webkit is simply better supported at this point, and like tomku said once it's bundled into a desktop app it doesn't really matter whether there's node in there or not.
1
u/mangecoeur Apr 23 '14
Very simply because node-webkit provides a very powerful way to wrap a web-app in a desktop interface, giving you access to native menus, command shell, file manipulation, etc. This made it very easy to build a minimum working product to test the idea
Also one idea was to monkeypatch the IPython notebook page as it loads in order to pull out its menus and place them in the menu bar. But for now I wanted to prioritize just getting it working
2
u/ceeeeej Apr 23 '14
Interesting project, certainly would help anyone that is timid with using the command line.
I use a Fluid SSB to get my iPython Notebook into it's own container and not running in my browser. You can also use Automator on OS X to create an Automator based application that loads the URL in a "Website Popup".
Where did the icon come from?
2
u/mangecoeur Apr 23 '14
Yeah I looked at similar "make webapps" methods including using Automator (in fact wrote a blog post about it http://mofanim.wordpress.com/2012/01/30/ipython-as-a-mac-app/) but I wanted a couple of things: Being able to launch Ipython from the desktop app itself and being able to configure it to use any existing ipython install (I tend to switch between a couple of venvs for different projects). Also, this was fun procrastination!
1
2
Apr 22 '14
Why's this getting downvoted? Seems like a legitimately useful project to me.
4
u/mangecoeur Apr 22 '14
Your guess is as good as mine. I knocked this together because I thought it was neat :) Well its mostly a thin wrapper/launcher for regular old ipython. Full integration would be nice, but I just don't have the time.
-4
u/spinwizard69 Apr 23 '14
I'm sitting here actually wondering what this is, it certainly isn't clear from the linked site.
Answer the question - what does it do for me and you might see positive responses.
5
u/farsass Apr 23 '14
From the linked page:
This is a proof of concept desktop interface for the Ipython Notebook.
That's very clear if you know what IPython notebooks are
-15
u/spinwizard69 Apr 23 '14
This is a proof of concept desktop interface for the Ipython Notebook.
OK so what does that mean to you that is the phrase "desktop interface". Because honestly it could mean a number of things.
That's very clear if you know what IPython notebooks are
Well I have a word for that -baloney-! Between this response and the delivery of the info on GitHub I'm not too sure you will get many interested parties. Bad attitudes and an inability to communicate don't attract a lot of followers.
6
1
1
u/brownck Apr 23 '14
Tried it on my mac osc 10.7.5. The bundle app just loaded an empty window. Is there a way to configure the default ipython path?
1
u/mangecoeur Apr 23 '14
Assuming you have IPython installed, you need to configure it with the full path of your IPython executable - I know it's not very user friendly, but this is alpha quality software I'm afraid.
If you go to the command line and type "which ipython" it will give you the full path of the ipython executable, you must then set this path in the configuration, not fogetting to include the "notebook" and "--no-browser" options
1
u/brownck Apr 23 '14
How do I set this full path in the configuration? How do I get to the config setting?
1
u/mangecoeur Apr 23 '14
Click the "configure" button on the start page, or go to Server -> Configure.
If you mean that the start page doesn't even show up (the one that says "Welcome to ipython desktop" like the screenshots) then congratulations, you've found a bug!
You can try going to View -> refresh to see if that helps. If that doesn't then I can't do much from where I'm sitting - it works in OSX 10.9 and I have no way of testing on other versions.
If you are feeling enthusiastic you can get the source and follow the build instructions and run it in dev mode (I recommend enabling the toolbar in package.json so you can see the debug console). Then you can try and figure out your problem. If you do this, create an issue on github to track your progress and I will try to help however I can.
1
u/brownck Apr 23 '14
Unfortunately, I don't even see the Welcome to ipython Desktop screen. It's completely blank.
1
u/vacuu Apr 23 '14
This is exactly what I'm looking for, and perfect timing...
However, not being able to use a relative path is a big issue for me. I'm making a distributable app with ipython as the main interface, and people receive it as a zip file, extract, and run. To use this, I'd need to be able to specify the relative location of ipython within the zip file directory.
Also, I run a script before launching ipython, so I'd have to be able to do that as well.
1
u/mangecoeur Apr 23 '14 edited Apr 23 '14
Glad that this fits your needs. I think if you want to make a redistributable app you could probably fork the project and hack in a mechanism to get the path to your specific python distro. I haven't yet grokked how node handles its subshell - using ipython with relative paths works in Dev mode, but not when bundled.
1
u/mangecoeur Apr 23 '14
P.s. Any and all contributions very welcome. I'm afraid the JS is a bit of a mess since I really threw this together in day or so, planning to neaten things up. But if you see something you can improve don't hesitate to do so, I'm very open to contributions!
1
u/BeatLeJuce Apr 23 '14
Hey, this sounds great!
Suggestion/Wish: It would be even better if this could get rid of the 2.0 command-mode/edit-mode bullshit (which as far as I understood was only introduced because the different browsers have different keybindings)
1
u/mangecoeur Apr 23 '14
'fraid not - I'm only planning on wrapping the ipython interface but i leave decisions as to how to works to the ipython core dev guys. Though from what i've seen of the 2.0 interface it sounds much worse than it is, you can pretty much keep using it as you did before but it adds a bunch of shortcuts that didnt exist
1
u/BeatLeJuce Apr 23 '14
Well, not really... if you want to edit the contents of a code-cell, you have to change into "edit mode". If you just start typing while in "command mode" (which is the default), your keypresses can have very weird effects: e.g. an 'x' would cut out a cell and a 'd' would delete the cell... so if you don't notice that you're in command mode, and type a sentence that contains two 'x', you will have unrecoverably deleted one of the cells in your notebook.
1
u/mangecoeur Apr 23 '14
oh right, haven't actually used 2.0 much since i upgraded, too busy procrastinating by building this thing :P... well if you click on a cell and start typing then, you're ok. I guess I will find out soon enough if it annoys me.
It seems there may be more demand for keyboard shortcut customizations than i thought . However doing that might mean diving much more deeply into the Ipython code than I wanted - I was hoping the keep this as thin a wrapper as possible so that people could test this out on a vanilla IPython install.
Once I figure out what i need to be able to hook into the notebook JS code I might consider submitting patches to upstream IPython if I need more flexibility to alter notebook behaviour - though I'm hoping that with the new Widget work the JS is already extensible enough...
-2
Apr 23 '14
Why in node? Why not python qt/gtk + webkit?
1
u/mangecoeur Apr 23 '14
Because it's much easier, node-webkit is built for wrapping webapps into desktop apps and gives you tight integration between the native platform and the web javascript context, allows you to work with pages in a reduced security context and more.
-3
Apr 23 '14
tight integration between the native platform and the web javascript context
specifically?
0
7
u/dlopoel Apr 23 '14
So what is the advantage of running your client instead of a browser? Less vertical space lost to browser specific things? What are the disadvantages?