PyObjC-framework-contacts provides Python bindings and wrappers for Apple's Contacts.framework on macOS. It allows Python developers to interact with the system's contact store, fetch, create, update, and delete contacts, and manage contact groups. The current version is 12.1, with a release cadence that generally follows macOS SDK updates and Python version support cycles.
pip install pyobjc-framework-contactsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to list the names of all contacts using `CNContactStore` and `CNContactFetchRequest`. It showcases basic object allocation (`alloc().init()`) and method calls specific to the Contacts framework within PyObjC. Running this code will likely trigger a macOS permission prompt for Contacts access if not already granted.
Upgrade to Python 3.10 or later, or use an older PyObjC version (e.g., PyObjC 11.x for Python 3.9 compatibility).
Review custom Python subclasses of Cocoa objects, especially those overriding `init` methods, to ensure correct reference handling under the new ARC model. Most standard usage should be unaffected.
If subclassing Cocoa classes in Python, be mindful of how `__init__` and `__new__` interact. Prefer using `alloc().init()` patterns where possible, or ensure your `__new__` implementation correctly handles initialization to avoid unexpected behavior or errors.
Before using `os.fspath()` with a Cocoa URL, ensure it refers to a local filesystem path. For other URL types, convert them to string representations explicitly if needed, or use Cocoa's own URL parsing and path access methods.