Setting up maemo 5 python development environment

Last week I finally got around to downgrading my laptop from karmic to jaunty. I did this for a couple of reasons. For my laptop the control of external displays regressed from working flawlessly, to crashing everytime it tried to detect an external display that it didnt boot with.Secondly,, eclipse has some major problems on karmic due to some changes. The fault is with eclipse, but it will be some time before any fixes work through to the eclipse based products I need to work with, so I downgraded.

This meant that I wanted to set up my development environment again for witter, and decided to try and make a better job of it.
So first thing I did was install esbox.
The python plugins are pretty good, and just simple stuff like the outline view of the code, makes navigating around much easier. And some basic syntax highlighting goes a long way to improve productivity.

However the main reason I stopped using esbox before was i failed to get it working with the subversion plugins. I ended up following the instructions here which got me going nicely.

So why is subversion support so important? If you are going to get even slightly into developing any app, you really want it in some kind of version control system. Ideally one hosted somewhere, so that should the worst happen to your pc, you dont lose it. But verison control is more than just backup, its freedom to make wide reaching changes without any worry that you can’t get back to a working system. Wither version control it is trivial to go back to any previous version. I personally like to be able to see how my application evolves over time, as it’s useful for writing blog posts about it.

So svn is just one possible version control system, however it is the one used by Which is the easiest place to find hosting for your maemo project, since you can just sign up and get it free and easy.
I personally would like to see more integration between garage and the talblet repository / build system. It would be cool is a correctly formed project in svn in garage could automagically be built correctly at the click of a button. But it isn’t. At least not yet.

So with esbox and svn support i was ready to checkout witter back into my workspace and get on with development. However I personally quite like having the fremantle development environment. With esbox you can just run python right on the device if you configure it as a remote environment. And there are distinct advantages to this approach, not least the fact you don’t have to setup scratchbox etc.
However I find it faster, once setup, to copy files into scratchbox and run locally, rather than ssh things accross to my n900 which i then have to switch to, then back to laptop etc.

The important things for python in the scratchbox development environment are,…don’t bother with the armel target. That is only really needed if you are compiling c for the device. The x86 target is better because you can actually run the emulated n900.
Once youve setup stcratchbox, done the updates, and installed the nokia-binaries pacakge. You will want to add the extras-devel repository to your /etc/apt/sources.list. This allows you to install all the required python libraries.
I’d list them here, but I find it useful to stumble over each library my app needs as I add the imports, since I can keep a list which will ultimatly make it into a depends declaration when you build your python project into an installable app.

The other thing you want to do in scratchbox is modify the /etc/resolv.conf file to match that of your host system. Without it you won’t be able to resolve any internet addresses. Given you are developing for a mobile internet device, it’s likely your app will need to access the internet.

I personally develop in esbox natively in ubuntu. Then copy my files into scratchbox. And I have Xephyr running, with maemo 5 up inside it. And a terminal logged into scratchbox where I can run/rerun my app.

Then when I want to copy onto my n900 I just scp the files to the device.

With this setup, anyone wanting to look at the witter source can just open a new project in esbox as an svn project and enter the svn details for witter (or whatever project from garage you are interested in) and you can start playing with the code much as the developer does.

It’s not as good as eclipse for java, but it makes devloping in python a little easier, and integration with svn makes working with a garage project nicer to do. Maybe in time there will be more great python help for would-be developers.

7 responses to “Setting up maemo 5 python development environment”

    • for some reason I thought pluthon was in esbox for the python support. but if that’s not the case maybe I’ll check it out and compare. the python support in esbox is nice enough.

  1. Daniel, thanks for this useful blog.
    When I decided to use Pluthon I’ve first compared it to Esbox.

    Installing Pluthon and deploying apps in Pluthon is actually much easier compared to Esbox. You dont need to install the scratchbox environment. Deploying an app is just like in Eclipse for Java EE. Just right click on the project and choose “Run as” > Web app. Your target is here your N900 device.

    It also includes a vnc viewer which you can use to control your n900 from within Pluthon.

    There are some drawbacks to this approach. Some really like to develop and test apps in a scratchbox env and deploy it later on on their devices. With Pluthon, the only way is to deploy it directly on your device (as you dont have a scracthbox environment).

    However, installing Pluthon on Ubuntu Karmic did not go very smoothly (because of xulrunner lib version conflict) but I eventually have managed to install it.

    So if you really want to have a scratchbox env to deploy your apps go with Esbox. If you dont choose Pluthon.

    • in terms of python support how does pluthon compare to esbox? does it use the same editor plugins? ideally I’d like an editor that’s aware of availiable modules and their methods, much as eclipse is for java.if there was some way of adding hildon modules too that would be very helpful

      • From what I have seen so far Python support seems weak. I could not get syntax highlighting and code completion working. According to the feature list on their website this must be possible.
        I’ll try ESBox to compare it to Pluthon.

Leave a Reply

Your email address will not be published. Required fields are marked *