PyObjC-framework-Cocoa provides Python wrappers for the core Cocoa frameworks on macOS, including CoreFoundation, Foundation, and AppKit. It acts as a bidirectional bridge, enabling Python developers to leverage Objective-C libraries and build full-featured macOS applications. Version 12.1 is currently available, with the project demonstrating active and sustainable maintenance, receiving regular updates.
pip install pyobjc-framework-cocoaVerified import paths — ran on the pinned version, not inferred.
This simple example demonstrates importing and using a basic class (NSDate) and a function (NSLog) from the Foundation framework, showing direct interaction with Objective-C APIs via PyObjC.
Upgrade Python to 3.10 or a newer supported version (e.g., `pyenv install 3.10.x` and `pyenv local 3.10.x`).
Upgrade Python to 3.9 or a newer supported version.
Migrate away from the `IMServicePlugIn` framework to supported macOS APIs if your application relies on instant messaging services.
Review classes with custom `__new__` and `__init__` for compatibility; avoid using `__init__` for classes relying on the default PyObjC `__new__`.
Applications interacting with Objective-C initializer methods may need to review their memory management assumptions, though for most Python users, this change makes PyObjC more compliant with underlying Objective-C semantics.
Replace Python lists with `NSMutableArray` and Python dicts with `NSMutableDictionary` for KVO-observed attributes.
Install Xcode Command Line Tools by running `xcode-select --install` in the terminal.