{"library":"pyobjc-framework-contacts","title":"PyObjC Contacts Framework","description":"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.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pyobjc-framework-contacts"],"cli":null},"imports":["from Contacts import CNContactStore","from Contacts import CNContact","from Contacts import CNMutableContact","from Foundation import NSArray"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from Contacts import CNContactStore, CNContactFetchRequest, CNContactGivenNameKey, CNContactFamilyNameKey\nfrom Foundation import NSArray\n\ndef list_contact_names():\n    \"\"\"Fetches and prints the names of all contacts.\"\"\"\n    store = CNContactStore.alloc().init()\n    \n    # Define the keys (properties) to fetch for each contact\n    keys_to_fetch = [CNContactGivenNameKey, CNContactFamilyNameKey]\n    \n    # CNContactFetchRequest expects an NSArray of keys\n    request = CNContactFetchRequest.alloc().initWithKeysToFetch_(NSArray.arrayWithArray_(keys_to_fetch))\n    \n    contacts = []\n    # Enumerate contacts: the third argument is a Python callable (block)\n    # that gets called for each contact found.\n    success, error = store.enumerateContactsWithFetchRequest_error_(\n        request, None, lambda contact, stop: contacts.append(contact)\n    )\n\n    if not success:\n        print(f\"Error fetching contacts: {error}\")\n        return\n\n    if contacts:\n        print(\"Found contacts:\")\n        for contact in contacts:\n            full_name = f\"{contact.givenName() or ''} {contact.familyName() or ''}\".strip()\n            if full_name:\n                print(f\"- {full_name}\")\n            else:\n                print(f\"- (Unnamed contact, ID: {contact.identifier()})\")\n    else:\n        print(\"No contacts found.\")\n\nif __name__ == '__main__':\n    # Note: Requires Contacts permission. First run might prompt for access.\n    list_contact_names()","lang":"python","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":null,"pypi_latest":"12.1","is_stale":null,"summary":{"python_range":"3.10–3.9","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pyobjc-framework-contacts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pyobjc-framework-contacts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.9,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pyobjc-framework-contacts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pyobjc-framework-contacts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.9,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pyobjc-framework-contacts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pyobjc-framework-contacts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.8,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pyobjc-framework-contacts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pyobjc-framework-contacts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pyobjc-framework-contacts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pyobjc-framework-contacts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.4,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}