Bill Bumgarner

2004-5-24

PyObjC evolves.

If you are using PyObjC, the version in CVS has evolved considerably over the last few weeks and is rapidly approaching a 1.1 release. The reverse chronological list of NEWS entries is quite telling, but about two weeks out of date as I write this. Most recent changes include better Xcode project templates and fixes for the way modules are initialized such that everything works as expected even in the face of various DYLD configuration options.

As always, using an additional framework in PyObjC is as simple as creating an NSBundle and invoking theBundle.principalClass(). This works fine for grabbing access to the ObjC API within the framework, but will not make any of the functions, constants, or globals available in PyObjC. To do that requires building a new python module. The easiest way to do this is to copy Lib/WebKite and Modules/WebKit to new directories within Lib and Modules (named appropriately). Then, remove the CVS cruft, rename the files, open the files and find/replace WebKit with the name of your framework. Finally, modify the root level setup.py and the Scripts/CodeGenerators/cocoa_generator.py scripts. Again, the easiest way is to find all mentions of WebKit and copy the code, changing WebKit references to refer to your framework.

Eventually, I could definitely see this process being refined such that it is both easier and the resulting module does not have to be built in the context of the PyObjC project itself.

Occasionally, I'll get an email asking if PyObjC is for real? It is. You really can build full featured Cocoa apps with it. And now there is an example. The new version of the BitTorrent client is written using PyObjC.

Comment on this post [ so far] ... more like this: [PyObjC] ... topic exchange: [PyObjC]