Python Project Templates

Author: Bill Bumgarner
Contact: bbum@codefab.com

To use the project templates, simply copy (or link) them into the Project Templates directory used by Project Builder. The project templates are also included in the PyObjC installer package.

Contents

Notes

Cocoa-Python Templates

The Cocoa-Python templates all create various different kinds of Cocoa application projects. Some of the resulting projects are incompatible with Apple's build of Python[#]. Be sure and pick the correct project type for your needs.

Cocoa-Python Application

A project created from this template is designed to implement standalone, pure-Python, applications that are compatible with Apple's build of Python as well as all other builds of python that support PyObjC.

When building the 'install' target, the resulting application wrapper will included the PyObjC module and can be launched on any stock OS X 10.2 system without requiring PyObjC to be preinstalled.

Cocoa-Python-ObjC Application

A project created from this template includes an embedded framework project into which all compiled code can be placed. Upon launch, the application automatically dynamically loads the embedded framework containing the compiled code.

Each Framework's Resources directory is automatically added to sys.path.

Cocoa-Python Document-based Application

This template works like the Cocoa-Python Application template in that it is compatible with the Apple build of Python. It creates an application that uses Cocoa's Multiple Document Architecture in the same fashion as the default Cocoa Document-based Application supplied with Project Builder.

Cocoa-Python-ObjC Document-based Application

A project created from this template includes an embedded framework project into which all compiled code can be placed. Upon launch, the application automatically dynamically loads the embedded framework containing the compiled code. It is based on the Cocoa-Python Document-based Application template. It creates an application that uses Cocoa's Multiple Document Architecture in the same fashion as the default Cocoa Document-based Application supplied with Project Builder.

Each Framework's Resources directory is automatically added to sys.path.


[1]Apple's build of python lacks a shared or static library to which an application can be linked. As such, it is impossible to embed the Python interpreter into an application. Because of this, it is impossible to directly link compiled objective-c directly into an application project. Hence, the "Apple Python compatible" projects are labeled as 100% pure Python. Since bundles and frameworks can be loaded into such applications, it is still possible to use compiled classes.