PyObjC ExtensionKit Framework
This package provides Python wrappers for Apple's ExtensionKit framework on macOS. It is part of the broader PyObjC project, which acts as a bidirectional bridge allowing Python scripts to interact with Objective-C libraries, including macOS Cocoa frameworks. The current version is 12.1, and the project maintains a consistent release cadence, often aligning with new macOS SDKs and Python version support.
Warnings
- breaking PyObjC frequently drops support for older Python versions. PyObjC 12.0 dropped support for Python 3.9, and PyObjC 11.0 dropped Python 3.8. Ensure your Python version is compatible with the PyObjC version you are installing.
- breaking PyObjC 11.1 changed how initializer methods (`init` family) are modeled, now correctly reflecting that they 'steal' a reference to `self` and return a new one, as per clang's Automatic Reference Counting (ARC) documentation. This affects object lifecycle and reference counting.
- gotcha Version 10.3 introduced a change affecting the use of `__init__` when a class or its superclasses implement a custom `__new__` method, causing it to break. This was partially reverted in version 10.3.1 to reintroduce the ability to use `__init__` in such cases.
- breaking `objc.classAddMethods` no longer supports arbitrary callable objects for adding methods to Objective-C classes.
- breaking Entire framework bindings may be removed if Apple deprecates and removes the underlying macOS framework. For example, the `IMServicePlugIn` bindings were removed in PyObjC 10.0 because the framework was deprecated in macOS 10.13 and removed in macOS 14.
Install
-
pip install pyobjc-framework-extensionkit
Imports
- ExtensionKit
import ExtensionKit
Quickstart
import ExtensionKit import objc print(f"Successfully imported ExtensionKit wrapper from PyObjC.") # In a real macOS application development scenario, ExtensionKit types # (like EXExtension, EXExtensionContext) would be used within the context # of defining or interacting with an application extension (e.g., share extension, # custom UI extension). # # A direct Python-only example demonstrating meaningful ExtensionKit # functionality without an accompanying Xcode project and host application # is not straightforward. This quickstart primarily verifies the installation # and import of the Python bindings for the framework. # # To see available symbols, you could inspect the module: # print(dir(ExtensionKit))