[Pythonmac-SIG] entire applications in python?

Boyd Waters bwaters at nrao.edu
Wed Oct 3 18:14:44 CEST 2007


On Oct 3, 2007, at 8:24 AM, Brett Calcott wrote:

> Is there "the book" for learning the basics of the mac system?
> Likewise, is there a book on objective-c for experienced programmers?

I attended the Big Nerd Ranch Boot Camp this Spring, which is a  
perfect introduction to native programming on the Macintosh platform.

I had never programmed Mac OSX via Objective-C before.

I have yet to really use these skills for a full application, but now  
I know enough to find my way around the guts of a Mac application. I  
may go ahead and write apps in PyObjC now that I know about the GUI,  
NIB files, bindings, and the like.

http://www.bignerdranch.com/
http://www.bignerdranch.com/classes/cocoa.shtml
http://www.bignerdranch.com/classes/python.shtml


I was able to re-package our open-source application suite as a  
Macintosh application bundle with a bunch of shell scripts and lots of  
install_name_tool re-mangling of the Python frameworks etc. I wish I  
knew more about py2app in order to make this easier, but I did it all  
"by hand" and by inspecting the layout of a "hello world" program  
created by py2app.

Our application (CASA) is a rather complex scientific data analysis  
application, implemented mostly as a bunch of C++ wrapped by Python,  
with a GUI or two via Qt.

While CASA is a lousy example of a "typical", GUI, Apple application,  
it's a nice lesson on deploying a (mostly) command-line shell tool on  
a Mac as an application, without alienating our "switcher" user base  
of scientists that are coming from a Linux environment.

So it may be of interest to see how I wrapped the generic python  
application via an AppleScript launcher (which in turn calls a shell  
script and then launches a Terminal window, runs a C++ wrapper than  
*finally* calls a Python script to setup IPython).  Yeah, that  
bootstrap process is way too convoluted, but it'll get better.

The program is NOT released yet or intended for general use (no  
support provided), but you're welcome to take a look at it:

https://wikio.nrao.edu/bin/view/Software/ObtainingCASA

At the moment (3 October 2007) the PowerPC version is still a tarball  
that installs a UNIX-y collection of libraries and Python; it's not a  
Mac "application".  The same thing is re-packaged as a "real" Mac  
application in the Intel version. By comparing the two you might learn  
something. I don't know. GPL'd.

I attempted to write some of this up in a poster:
http://www.aoc.nrao.edu/~bwaters/papers/WWDC-2007-CASA-poster.pdf

Hope this helps... it's not the recommended "Mac way" to do things,  
but it's how we ported from Linux.

  - boyd

Boyd Waters
Scientific Programmer
National Radio Astronomy Observatory
http://www.aoc.nrao.edu/~bwaters


More information about the Pythonmac-SIG mailing list