{"id":6127,"library":"pyobjc-framework-libxpc","title":"PyObjC Framework: LibXPC","description":"PyObjC-framework-libxpc provides Python bindings for the macOS XPC framework, allowing Python applications to interact with XPC services. It is part of the larger PyObjC project, currently at version 12.1, and follows a release cadence tied to 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","xpc","framework","interop"],"install":[{"cmd":"pip install pyobjc-framework-libxpc","lang":"bash","label":"Install `libxpc` framework bindings"}],"dependencies":[{"reason":"Provides the core bridge between Python and Objective-C, essential for all PyObjC framework bindings.","package":"pyobjc-core"}],"imports":[{"symbol":"libxpc","correct":"import libxpc"}],"quickstart":{"code":"import libxpc\nimport objc\n\ndef main():\n    print(f\"Accessing XPC framework symbols: {libxpc.xpc_main.__name__}\")\n    print(f\"XPC types available: {libxpc.xpc_type_connection.__name__}\")\n    # Note: A full XPC client/server requires more setup beyond a quickstart.\n    # This example only verifies the framework import and symbol access.\n    \n    # Example of a common PyObjC utility function, not directly libxpc but relevant.\n    class MyDelegate(objc.lookUpClass('NSObject')):\n        pass\n    print(f\"Successfully looked up NSObject: {MyDelegate.__name__}\")\n\nif __name__ == '__main__':\n    main()","lang":"python","description":"This quickstart demonstrates importing the `libxpc` framework and accessing a couple of its core symbols to confirm the bindings are correctly installed and available. A full functional XPC client or service would require more extensive setup."},"warnings":[{"fix":"Ensure your Python environment meets the minimum version requirement (currently >=3.10 for PyObjC 12.1). Upgrade Python if necessary.","message":"PyObjC major versions frequently drop support for older Python versions. PyObjC 12.x dropped Python 3.9 support, and PyObjC 11.x dropped Python 3.8 support. Always check `requires_python`.","severity":"breaking","affected_versions":"11.0+, 12.0+"},{"fix":"If subclassing Objective-C classes, be cautious with overriding `__new__` and `__init__`. Test initialization paths thoroughly, especially when upgrading between minor PyObjC versions. Refer to PyObjC documentation for `__new__` and `__init__` guidelines.","message":"Behavioral changes related to `__init__` and `__new__` in Python subclasses of Objective-C classes can cause unexpected initialization issues. PyObjC 10.3 prevented calling `__init__` in some scenarios, which was partially reverted in 10.3.1.","severity":"gotcha","affected_versions":"10.3, 10.3.1"},{"fix":"Review code that involves `init` methods of Objective-C objects, particularly if it involves manual reference counting or complex object graph management, to ensure it behaves as expected with ARC-compliant reference handling.","message":"PyObjC 11.1 introduced changes to how initializer methods are handled to align with Objective-C's Automatic Reference Counting (ARC) model. This ensures correct memory management but might subtly change behavior if existing code relied on previous reference counting semantics.","severity":"gotcha","affected_versions":"11.1+"},{"fix":"Before upgrading PyObjC, check the release notes for any removed framework bindings if your application relies on less common or deprecated macOS APIs. Plan to migrate away from deprecated macOS frameworks.","message":"Older frameworks or parts of frameworks may be removed entirely when macOS drops support for them. For example, PyObjC 10.0 removed `IMServicePlugIn` bindings as the framework was deprecated in macOS 10.13 and removed in macOS 14.","severity":"deprecated","affected_versions":"10.0+"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}