{"id":6083,"library":"pyobjc-framework-collaboration","title":"PyObjC Collaboration Framework","description":"PyObjC-framework-collaboration provides Python wrappers for Apple's Collaboration framework on macOS, enabling Python scripts to access identity and user selection features. It is part of the broader PyObjC project, a bridge between Python and Objective-C. The current version is 12.1, and it maintains an active release cadence, typically aligning with macOS SDK updates and Python version support.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","objective-c","cocoa","bindings","collaboration","identity"],"install":[{"cmd":"pip install pyobjc-framework-collaboration","lang":"bash","label":"Install the Collaboration framework bindings"}],"dependencies":[{"reason":"This package provides the core bridging functionality between Python and Objective-C, which all PyObjC framework wrappers depend on.","package":"pyobjc-core"}],"imports":[{"note":"PyObjC frameworks map directly to Python packages. Classes, constants, and functions from the Collaboration framework are available after importing `Collaboration`.","symbol":"CBIdentity","correct":"from Collaboration import CBIdentity"}],"quickstart":{"code":"import objc\nfrom Collaboration import CBIdentityAuthority\nfrom AppKit import NSApplication, NSApp # Required for an active run loop in UI applications\n\ndef list_identity_authorities():\n    \"\"\"Lists available identity authorities on the system.\"\"\"\n    authorities = CBIdentityAuthority.allAuthorities()\n    if authorities:\n        print(\"Available Collaboration Identity Authorities:\")\n        for authority in authorities:\n            print(f\"- {authority.displayName()} (Type: {authority.type()})\")\n            if authority.isLocal():\n                print(\"  (Local Authority)\")\n            print(f\"  Identifier: {authority.identifier()}\")\n    else:\n        print(\"No Collaboration Identity Authorities found.\")\n\nif __name__ == \"__main__\":\n    # For non-UI interactions, a run loop is not strictly necessary but\n    # for many PyObjC applications, especially those involving UI,\n    # NSApplication.sharedApplication() or an active run loop is needed.\n    # Starting a minimal AppKit environment for consistency.\n    if not NSApp:\n        NSApplication.sharedApplication()\n\n    list_identity_authorities()","lang":"python","description":"This quickstart demonstrates how to import the `Collaboration` framework and list the available identity authorities on a macOS system. For interactive operations like presenting an identity picker, an `AppKit` run loop would typically need to be active. The example includes a minimal `NSApplication` setup for broader compatibility with PyObjC patterns, though it might not be strictly necessary for simple authority listing."},"warnings":[{"fix":"Upgrade your Python environment to Python 3.10 or later for PyObjC 12.x. Always check `requires_python` on PyPI or the PyObjC changelog for specific version requirements.","message":"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.","severity":"breaking","affected_versions":"11.0, 12.0, 12.1"},{"fix":"Review custom Python subclasses of Objective-C classes, especially those overriding `__new__` or `__init__`, to ensure they align with PyObjC's instantiation model. For ARC changes, understand that `init` methods now 'steal' a reference to `self` and return a new one.","message":"PyObjC 10.3 introduced changes to `__new__` and `__init__` behavior, specifically disallowing direct use of `__init__` for classes relying on PyObjC's `__new__`. Version 10.3.1 partially reverted this to allow `__init__` when a user implements `__new__` or a superclass implements `__new__`. PyObjC 11.1 also aligned initializer methods with `clang`'s ARC documentation, affecting reference counting for `init` family methods.","severity":"breaking","affected_versions":"10.3, 10.3.1, 11.1"},{"fix":"Update your application to use modern macOS APIs for instant messaging or collaboration, as the `IMServicePlugIn` framework is no longer supported by Apple or PyObjC.","message":"The `IMServicePlugIn` bindings were removed in PyObjC 10.0 as the entire framework was deprecated in macOS 10.13 and removed in macOS 14. Code relying on these bindings will fail.","severity":"deprecated","affected_versions":"10.0 and later"},{"fix":"Only use `pyobjc-framework-collaboration` in macOS environments. For cross-platform development, consider alternative libraries or platform-specific conditional logic.","message":"PyObjC is a macOS-specific library and will not install or run on other operating systems. The frameworks it wraps (like Collaboration) are Apple-proprietary.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always check for `None` before calling methods on PyObjC-wrapped objects that might originate from Objective-C `nil` values. E.g., `if my_obj is not None: my_obj.doSomething_()`","message":"Unlike Objective-C, where sending a message to `nil` (equivalent to Python `None`) is a no-op, attempting to call a method on a Python `None` object (which PyObjC translates from `nil`) will raise an `AttributeError`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"When developing multi-threaded PyObjC applications, especially with free-threading, consult Apple's documentation for thread-safety guidelines of the specific Cocoa classes being used. Employ Python's threading primitives (locks, semaphores) where concurrent Objective-C access might be unsafe.","message":"While PyObjC 11.0 introduced experimental support for free-threading (PEP 703) with Python 3.13, and later versions have improved it, note that Apple's underlying frameworks are not necessarily thread-safe. Concurrent access to Objective-C collections (like `NSMutableArray`) or `nonatomic` properties without explicit locking can lead to issues.","severity":"gotcha","affected_versions":"11.0 and later (Python 3.13+)"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[]}