It is an ../OSA language component, allowing client applications to load and run scripts via the language agnostic OSA API. Client applications can use the OSA API to implement features such as Folder Actions (System Events), Mail rules, iCal alarm scripts, OSA script editing (Script Editor, Script Debugger), etc.
Python provides extensive third-party application scripting support and limited OSA language component support. It also supports AppleEvent handling and can load and use other OSA language components.
Python has long supported sending AppleEvents via the high-level aetools and gensuitemodule modules in its standard library. However, these modules have always had a number of shortcomings and have grown increasingly troublesome in recent Mac OS X releases; in particular, they are completely broken on Intel-based Macs. As a result, these and other AE/OSA-related modules will be removed in a future Python release and their use should be avoided.
There is also a low-level extension, Carbon.AE, that can be used to construct and send AppleEvents. Using this API requires detailed knowledge of the Apple Event Manager, however, and is rarely used directly.
A modern replacement to aetools and gensuitemodule, the ../AppscriptModule, has been available since late 2003. (A second project, aeve, has since been discontinued.)
PythonOSA provides a working implementation of the core OSA interface, allowing OSA scripts written in Python to be loaded, stored, compiled and executed. More advanced OSA features, such as the ability to send and receive AppleEvents to and from the host process are not currently available.
The Python standard library has long provided a basic AppleEvent handing framework, MiniAEFrame, but as with aetools and gensuitemodule this module is unsupported on Intel Macs and will be removed in future, and its use should be avoided.
The low-level Carbon.AE extension can be used to install Apple event handlers, though lacks the ability to install coercion handlers and requires detailed knowledge of the ../AppleEventManager to use, so is rarely used directly.
There are two modern, high-level options for implementing AppleEvent handling in Python-based applications: aemreceive (bundled with the AppscriptModule) can be used to install AppleEvent handlers although it provides no assistance for resolving object references so is best suited for use in applications that don't implement an ../AppleEventObjectModel.PyObjC-based applications can leverage the /AppKit framework's built-in Cocoa Scripting support to implement a full AppleEventObjectModel.
PyObjC includes a wrapper for the (currently undocumented) OSAKit API on OS 10.4 and later.