[triangle-zpug] Desktop apps in Python?

Tom Bryan tbryan at python.net
Sun Aug 15 08:05:45 CEST 2004

On Friday 13 August 2004 10:21 pm, Jim Allman wrote:

> What's the current state of the art in building standalone desktop apps
> with Python? 

Not sure.  I've never built installers that were not targetted at a very 
specific audience/platform.

> I'm trying to figure out how realistic it is to attempt
> cross-platform, GUI applications without dependencies on existing stuff
> like .NET frameworks, Python interpreters, etc.

Well, anyone actually distributing Python applications needs to do the same 
work as someone distributing any other type of application.  When we install 
one of my company's C# and C++ apps, we have to install the C++ runtime 
library because it's not likely to be on the machine.  If it is on the 
machine, it may not be the right version.  So, we install it locally.  

Basically, commercial applications normally install a Python interpreter 
locally.  The whole Python install isn't *that* big, and something like 
freeze (I've never used it) can supposedly ensure that you're including the 
smallest amount of Python that you need for your specific application.

The other option is to check various dependencies and include prerequisite 
checks.  This option provides a smaller install and avoids forcing the 
customer to have multiple Python installs on their machine, one for each 
Python app.  So, on Red Hat, your RPM might "Requires: python >= 2.1.0."  
That way, the admins can use their normal tools for installing Python once 
globally, and you can just depend on the vendor-supplied packages.  Of 
course, that means that your application may break if the user upgrades 
Python out from under you.  

This type of question pops up from time to time on comp.lang.python.  Maybe 
you should start a new thread there asking for pointers to the current "best 
practices" in creating Python installers for multiple platforms.


You also should definitely look at distutils 

I learned how to make RPMs partly by looking at what distutils was doing.  :-)

> I gather that this should be possible by piecing together several
> 	- py2exe (or Psyco compiler?) for freedom from the Python interpreter
> (hm, Windows only...)

I think that a lot of people just include the Python interpreter, installed 
locally, with their application.

> 	- Python's freeze utility? or Gordon McMillan's Installer?

Sometimes frozen.

I haven't tried to create an installer that included various things like 
wxWindows and wxPython before.  Like I said, install locally with your 
application, or check that the version you need is installed globally and 
point to the other projects' installers.

> The more I read, the shakier this sounds. Jeez, all I want to do is to
> distribute standalone apps for Windows, Mac, and *nix, without the user
> having to do more than a simple install. Is this unrealistic?

Not unrealistic, but installing software isn't normally trivial unless you 
don't need a lot of stuff (can rely on the core language).  My team at work 
has a fairly straightforward C# and C++ app for the desktop and an 
application server.  We have one guy who spends 10-25% of his time updating 
the installer for one reason or another.  Writing good installers isn't 
trivial.  It's not impossible or hard, but it takes time to understand the 
issues involved, add dependency checks, figure out how various vendors or 
projects expect you to access their code in a runtime environment, permit for 
rollbacks and uninstalls, test the installer, etc.

> I'd love to hear anyone's experiences with this, pointers to others
> who've pulled it off, and general advice.

Sorry.  Like I said, I mostly do Python for internal use, so I don't have to 
worry about it.  I just point the other developers to the python installer.  
The one time I built installers, it was building RPMs targetted at Red Hat 
only.  We created a set of RPMs that needed to be installed in a specific 
order, relying on Red Hat's Python distribution.  If you're interested in 
seeing that, you can browse what I produced here.  

All other software installers I've seen have been the responsibility of the 
"build team."  If you find any good pointers/docs, I'd be interested in 
seeing them.  

Good luck,

More information about the triangle-zpug mailing list