Archive for the 'Python' Category

Oct 11 2008

Dynamic Languages for Desktop Apps

Published by Winni under Programming, Python

I posted this on Ted Leung’s blog today as my comment on the discussion on his ‘Dynamic Languages for Desktop Apps’ article. For those who don’t want to read the entire story, Ted is basically calling for more desktop applications that should be written (almost entirely) in dynamic languages like Python. He says that dynamic languages have been embedded as scripting languages into desktop apps for years, but since the performance of dynamic language runtimes has significantly increased over the years, “it should be possible to write really good desktop applications using them”.

His article can be found here:

http://www.sauria.com/blog/2008/10/10/retry-dynamic-languages-for-desktop-apps

One other commenter mentioned Basic and compared it to scripting languages, but I think he was rather mistaken there.

Here’s my post:

Well, Basic is neither a dynamic nor a typical scripting language. Rather the opposite: All modern Basic dialects are compiled, and when you look at Basic-compilers like BlitzMax or PowerBasic, those use strongly typed and static languages that produce compiled code which is at least as fast as the one emitted by any available C compiler. So, no, Basic is not a valid comparison here, not even if it’s VB.NET.

Civilization IV uses Python for its game logic, but I’m still waiting for a success story for PyGame - even that project’s homepage does not name a ‘real’ product that uses it, where ‘real’ stands for a game that has sold at least a couple of hundreds of thousands of copies. The pyglet project also seems to be under more development recently than PyGame, and it looks quite promising - although there are also no high profile/high visibility apps yet being made with it, as it seems.

Unfortunately the same has to be said for wxPython - there are no visible successful applications with large customer bases written in wxPython. At least I haven’t heard of one except for maybe Boa Constructor, which is rather complicated to get running on my platform, OS X, and an IDE is not necessarily a mass market application anyway. I would be very happy to hear of a very successful commercial wxPython application.

In direct comparison and outside of large corporate environments (where plenty of Java desktop apps exist), Java has at least Tribal Trouble (a very nice commercial and successful 3D real time strategy game), CyberDuck (one of the best FTP clients for OS X), Limewire, Netbeans and Eclipse, which both are not only IDEs, but rich client platforms on which several large desktop applications can be and actually already are built (BlueMarie, e.g.).

Deployment issues could be one of the things that is holding Python back on the desktop. Not everybody feels good about distributing source code or easy-to-reverse-engineer-byte code in an application bundle (OS X) or encapsulated in an .exe file. But maybe that’s more of a psychological problem than a technological one.

The reputation of being slow - whether or not this is justified does not even matter - is another issue. This one is still holding Java desktop apps back, although there are success stories like Eclipse out there.

Other problems that I see could be the fact that Python does not necessarily come with a modern GUI framework out of the box, and it does not come with pyglet or Pygame either in the standard distribution.

Then, as a Mac user in the year 2008, you don’t want to be caught writing Carbon-based applications anymore - but that’s all that wxPython will give you. And if you begin using the pyobjc-bridge: Why would you want to do that in the first place? When you’re giving up multi-platform capabilities, you could as well go with the native Objective-C language which has higher performance to offer than Python but at the same time is still dynamic and even garbage collected.

On Windows, you’d face a similar situation with C# and the .NET framework, and you’d have to ask yourself the same question whether it makes any actual sense to use Python instead of the platform’s native language.

Linux might be a different story, but Linux is far from becoming a widely accepted desktop platform in terms of user base and market share. It’s a huge server platform, but still basically irrelevant on the desktop.

One response so far

Aug 11 2008

Python essentials for OS X Leopard

Published by Winni under Mac OS X, Python

OS X Leopard comes with a version of Python pre-installed, but this version is neither up-to-date nor is it a good choice when you want to create application bundles that also have to be compatible with OS X Tiger. That is why I have chosen to install the official Python distribution from Python’s official website. It can be found here:

  • http://www.python.org/download/

For GUI applications, wxPython probably is the best choice available for the Python programming language and platform. I use the Unicode-version from here:

  • http://www.wxpython.org/download.php#binaries

I use the pydev plugin for Eclipse for my Python coding, and I find it great!

  • http://sourceforge.net/project/showfiles.php?group_id=85796

I use it with the classic edition of Eclipse:

  • http://www.eclipse.org/downloads

For deployment, py2app is the tool of choice, and it can be obtained from here:

  • http://pypi.python.org/pypi/py2app

A nice multimedia and windowing library for Python is pyglet:

  • http://www.pyglet.org/download.html

I install PyGame from the source code:

  • http://www.pygame.org

PyOpenGL can be found here:

  • http://pyopengl.sourceforge.net

Rabbyt is a fast 2D sprite engine for Python that uses OpenGL and works nicely with pyglet. You can find it here:

  • http://pypi.python.org/pypi/Rabbyt
  • http://matthewmarshall.org/projects/rabbyt (This is the developer’s homepage)

For using SQLite with Python, I found pysqlite2 here:

  • http://oss.itsystementwicklung.de/trac/pysqlite/wiki/WikiStart#Downloads

All of the modules and libraries that I use are not licensed under the GPL, and I want to keep it that way. Strangely enough, the BSD-licensed database server PostgreSQL caused me some problems here, and it took me a while to find a Python library for it that was available under a more BSD/MIT-style license. However, finally I discovered PyGreSQL, which you can get from here:

  • http://www.pygresql.org/readme.html#where-to-get

If you need more number crunching power or simply higher performance, Pyrex might be what you’re looking for. You can get it from this website:

  • http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex

Last but not least something really interesting for multi-threaded programming: Stackless Python.

  • http://zope.stackless.com

Some of these libraries are only available in source code form for OS X, but the default sudo python setup.py install command is usually all the magic that you have to use to get them up and running.

These books are passionate works of love and the best titles that I’ve found about Python:


This one also comes in very handy:

No responses yet

Next »