Google code adds Mercurial support

April 25, 2009 by


It also seems that they have their own Bigtable-based backend implementation.


Qt goes LGPL, and PyQt considerations

January 14, 2009 by

Using planet python for soapboxing:

Will PyQt be the new “standard” python GUI toolkit soon? After the enthusiastic reception of Qt going LGPL (thanks to Nokia), I can imagine that beginners will be probably be pointed to PyQt for their GUI needs, now that the license problem is no more. Obviously it’s too big to bundle with Python, but not too big to recommend as the first download…

Other toolkits have their benefits, but comparisons have been typically shouted down by previous problematic licensing. We can now forget that, and really see if other toolkits can actually match Qt on technical merits. Who knows, perhaps this move will invigorate GUI app development again, now that everyone is doing web apps ;-).

Note: LGPL PyQt hasn’t been announed yet, but it’s fair to speculate that it will happen.

“Tagging” the ipython prompt

September 18, 2008 by

People that run many ipython sessions at the same time will want to “mark” an ipython session, so that they will immediately know what window they are in by just looking at the prompt. If you have 15 ipython sessions with exactly the same prompt, it becomes very hard to tell them apart.

Sh profile just got a feature that allows you to tag the prompt by just assigning to _prompt_title variable. For example, I have the following invocation in the end of my .bashrc in scratchbox:

ipython -p sh -i -c “_prompt_title=’sbox'”

Now, Scratchbox prompt will look like this:
sbox[~]|4> pwd

This allows me tell apart the terminals that are running in scratchbox from the ones running on linux host. Obviously you can assign to _prompt_title during a live ipython session, if you decide to “dedicate” that particular session to a particular task.

PyDev acquired

August 30, 2008 by

On “unrelated” front: it seems PyDev has been acquired by Aptana. The press release also comments on the increasing popularity of python, thanks to Google App Engine.

Get IPython working on Maemo scratchbox

August 28, 2008 by

Here’s what you need to do to get ipython running on maemo scratchbox (Diablo, though also applicable for Chinook with slight modifications):

Ensure that you have the following in /etc/apt/sources.list:

deb diablo free non-free

Run ‘apt-get update’ and ‘apt-get upgrade’ (this is because the python2.5 shipped with Diablo comes without readline support), then install setuptools:

apt-get install python2.5-setuptools

Install ipython with easy_install:

python2.5 /usr/bin/easy_install ipython

HOWEVER, the maemo sdk’s have a buggy readline, so you should fix the cd completer if you are using a newer ipython than 0.8.4. In that case, you should add the following lines to your

import ipy_completers
ipy_completers.greedy_cd_completer = True

And to always get the latest nightly snapshot of ipython, do:

cd ipython-dev-nightly
python2.5 install

Firefox 3 beta on ubuntu 8.04 crawlage & solution

May 23, 2008 by

(* fanfare_for_first_offtopic_post *)

Since this blog is not strictly restricted to IPython subject matter, here’s a good tip: firefox 3 beta on Ubuntu 8.04 LTS is quite slow, at least on nvidia cards. Especially scrolling around gmail can be a pain. A good solution is installing firefox 2 (sudo apt-get install firefox-2). Then, you can set firefox 2 as your default browser from System -> Preferences -> Preferred applications, select “Custom” web browser and enter “firefox-2 %s” as the command.

Problem solved. Otherwise, 8.04 LTS pretty much rocks on all departments, at least for desktop use.

To navigate back to on-topic realm, IPython 0.8.3 is pretty much ready; release candidate 1 has been built, and there should be no more bugfixes, provided that the installers (that have seen some changes) work correctly. Try them out at launchpad

Embedding IPython in GUI apps is trivial

May 15, 2008 by

Here is a little known secret: IPython can be trivially embedded to GUI apps with event loops. This is verified to work with Tk and Qt4, at least.

What you need to do is this:

def embed_ipython(w):
    from IPython.Shell import IPShellEmbed
    ipshell = IPShellEmbed(user_ns = dict(w = w))

Here ‘w’ is a central object of some kind that you want to expose to IPython (to manipulate, test various methods, etc).

My GUI app initialization is like this:

if __name__ == "__main__":
    app = QApplication(sys.argv)
    window = Window()

What may be nonobvious here is that embed_ipython() call never returns. There is “secret sauce” in at least Qt4 and Tk that allows the GUI event loop to proceed while IPython read-eval-print loop is being handled (the same sauce that allows you to operate GUIs in standard interactive python prompt). One would intuitively guess that surely the REPL should be running in a separate thread, but this is not the case. While the UI event loop (or IPython) is doing something time-consuming, the other party will be blocked for that time – but there is the huge benefit that everything occurs in the same thread, that of the GUI event loop.

Greedy completer

May 14, 2008 by

Every now and again, we at IPython0 get complaints about the strict criteria that we use for tab completing python attributes; basically, we only tab complete expressions where side effects are not likely when calling ‘eval’, as in expression<TAB> (we eval, then get attributes from the resulting object). An expression we do not eval is foo(12) + TAB, because calling foo(12) may do something nasty that the innocent ipythoneer may not be aware of.

Until now, that is. Sometimes all you care about is convenience – maybe your interactive work is not so side-effect-sensitive, maybe you trust yourself enough to not press tab after a dangerous command, or maybe you just enjoy living on the edge. I just added IPython extension to the trunk, which does not really care about what it evaluates – pressing TAB is enough, and if something breaks, the user gets to keep both pieces.

Activate it by typing “import ipy_greedycompleter” (or “import ipy_gr” + TAB for completion savvy), or add it to you

I should probably also mention that you can get IPython trunk (it’s probably stabler than 0.8.2 at this point) from launchpad by doing:

bzr branch lp:ipython

— Ville

wx backend get options handling

April 25, 2008 by

The wx Ipython widget now get supports for options. Two options are available right now:

– Autocompletion representation style: Scintilla mode or Ipython legacy one.

-Background color switch: Black or White.

I’ve added a hook so you can define what to do when an option is changed.

Want to try this? Run wxIpython demo app in Ipython/gui/wx and report any bug!

Editra ipython plugin under work

April 25, 2008 by

Editra ( ) is a programmer’s source editor that is now bundled with wxpython distribution.

It has a plugin architecture so external can connect to it to provide added functionality.

I’m currently working on integrating wx IpythonView widget inside it. So user will have a new ipython based alternative to classical wx pyshell.

Current version of the plugin is 0.3beta and bundle ipython/readline/and wx ipython widget into one egg. It supports infinite loop breaking, multiline copy/paste, options save/restore.

Thanks to cody precord, author of editra, it also works for MacOSX.

There still lot of work so… stay tuned for more news!