[Pythonmac-SIG] Is Python right for what I want to do?
Bob Ippolito
bob at redivi.com
Sun Aug 15 20:02:02 CEST 2004
On Aug 15, 2004, at 12:46 PM, Rodney Somerstein wrote:
> I have a project that I want to work on which will eventually be open
> source. I think that Python and wxPython will allow me to do
> everything that I need capability-wise. Where my questions come in is
> really more related to packaging and delivery. In the past, I have
> avoided Python, especially on the Mac, as the installation
> requirements for an end-user application have seemed overly complex.
> It seems that I might now be able to produce a double-clickable
> application with a simple installer that could be used cross-platform.
On OS X, you can put Python and all other dependencies inside the
application bundle itself, with no installer required. On Windows,
it's easy to make a simple installer. On Linux you pretty much just
have to hope the user is smart enough to figure out the dependencies
(unless you do per-distro packaging).
> Is this actually easy to do? Does the user have to install Python
> separately, or is it part of an application created with
> bundlebuilder? (I know it is pre-installed on Mac OSX, but this is an
> issue for other platforms). Can bundlebuilder include other needed
> libraries, such as wxPython in an application?
You can either use the existing installation of Python (with 10.3+) or
bundle a version of Python inside your application with bundlebuilder
(or some similar tool). bundlebuilder isn't very good right now, so
you will need help with that, but there is a tutorial on the wiki and
quite a few people on this list that can answer questions.
> Next comes the question of support for new versions of Python. I note
> that at the moment, Mac OSX is stuck with version 2.3 of Python
> without extraordinary efforts (from an end-user standpoint) to install
> updates. When 2.4 comes out, would I be able to use this in an
> application and have end-users install such an update as part of an
> application install? Or will they have to manually install the
> MacPython update? Obviously I want to avoid this last as eventually
> when Apple upgrades to 2.4.x I don't want my application to cause
> problems for users. What are the current plans for Python 2.4 support
> on the Mac? Will it make it into Tiger? Has an update mechanism been
> found that will eliminate conflicts with Apple's built-in Python if
> not? (I found mention of such an effort in the archives, but no
> details)
According to public information (Apple has released the code), the
build of Tiger as of WWDC uses Python 2.3.3. There is, of course,
plenty of time for this to change.. but you can assume at least 2.3.3.
Since it is the same major version of Python, anything compiled against
the Python 2.3.0 on Mac OS X 10.3 should just work with 10.4's (and
vice versa, to a large extent).
Mac OS X 10.3 will always have conflicts with other versions of Python
due to a couple problems with Python 2.3.0. All of the problems have
been identified and fixed in later versions of Python. It's possible
to "monkeypatch" Python 2.3.0 and give it correct behavior, but that
requires changing privileged files and it not recommended. In almost
all cases, Python 2.3.0 is good enough and doesn't need to be upgraded.
One thing that is currently very difficult is to support Mac OS X 10.2.
You will need access to a machine running Mac OS X 10.2 in order to
build compatible software. It's *possible* to do it without access to
such a machine, but it's VERY difficult and I doubt that you'll get
anyone to walk you through it. I build a "template bundle" for my
applications from a machine running Mac OS X 10.2. This contains
extension modules, parts of the standard library that I use, Python
itself, a bootstrap executable, and then I just swap out the (pure
python) application code and resources from a machine running Mac OS X
10.3. Though my build process uses Xcode and the PyObjC application
template, I did most of the prep work by hand (no bundlebuilder, etc.).
> Is there anything else I would want to be aware of?
wxPython has had a history of bugs on Mac OS X. This situation is
constantly improving, and it may be fine now, but I highly suggest you
take a look at other wxPython applications that have Mac OS X builds
and see if they work well enough for you. Jäger is the only one that
does regular builds that I can think of.
> These kinds of things are really the only thing that has kept me from
> using Python. I am a hobbyist and want my efforts to be easily
> available to other users. I want to produce applications with a nice
> user interface, not command-line tools. I don't want users to have to
> do complex installs to get the things I write running.
The tools to build self-contained Python applications with nice user
interfaces have been available for years. The tools for packaging
still aren't very good though (but it's also possible to do "by hand",
since bundles are just folders). They haven't really improved much
since they were first written, but that will change at some point.
Hopefully soon.
> So, back to the title of my message, is Python right for what I want
> to do? Or is it still not quite there?
Python (but not wxPython) has been technically ready to do what you
want to do on Mac OS X for several years. The packaging tools are not
polished but they do work. Better packaging tools are partially
developed and will be available eventually, but I can't make any
promises as to when I'll have mine done (or if anyone else will come up
with something before me).
The "state of the art" packaging tool is bundlebuilder2 (currently
living at http://svn.red-bean.com/bob/macholib/trunk/ - I don't think
it's in working condition right now) , which is a marginal improvement
over the original bundlebuilder. Basically does the correct thing with
dylibs and frameworks, which makes packaging more automatic (it knows
what non-standard libraries your python extensions linked to) and it
makes the bundles themselves compatible with more machines (it's
possible to have conflicts if the 'correct thing' wasn't done).
There is also the Python Cocoa-Application Xcode template as part of
PyObjC which is the "state of the art" Python bootstrap application.
Even if these two things were combined as-is, it still wouldn't be a
very good tool, so I'm toying with some other designs for packaging
software. One of my current ideas, and probably the one I will finish
first, is to just rip py2exe apart and develop "py2app", which would
have a very familiar API.
-bob
More information about the Pythonmac-SIG
mailing list