{"id":6153,"library":"pyobjc-framework-passkit","title":"PyObjC PassKit Framework","description":"pyobjc-framework-passkit provides Python bindings for Apple's PassKit framework on macOS, enabling Python applications to interact with Wallet passes. It is part of the larger PyObjC project, offering direct access to the native macOS APIs. Version 12.1 is current, with releases typically synchronized with new macOS SDKs and PyObjC core updates.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macOS","Apple","framework","PassKit","PyObjC","Wallet"],"install":[{"cmd":"pip install pyobjc-framework-passkit","lang":"bash","label":"Install pyobjc-framework-passkit"}],"dependencies":[{"reason":"This package provides bindings for a specific macOS framework and depends on the core PyObjC bridge.","package":"pyobjc-core","optional":false}],"imports":[{"note":"The entire PassKit framework's symbols become available under the `PassKit` module.","symbol":"PassKit","correct":"import PassKit"},{"note":"While Python allows `from PassKit import PKPassLibrary`, the standard PyObjC pattern is to import the framework module and access classes/functions via `FrameworkName.Symbol`.","wrong":"from PassKit import PKPassLibrary","symbol":"PKPassLibrary","correct":"import PassKit\npass_library = PassKit.PKPassLibrary.sharedPassLibrary()"}],"quickstart":{"code":"import PassKit\nimport objc\n\ndef check_passkit_availability():\n    if PassKit.PKPassLibrary.isPassLibraryAvailable():\n        print(\"PassKit library is available on this system.\")\n        pass_library = PassKit.PKPassLibrary.sharedPassLibrary()\n        print(f\"Shared Pass Library object: {pass_library}\")\n        # Note: Interacting with passes (e.g., listing, adding) often requires\n        # your Python script to be bundled as a properly signed macOS application\n        # with specific entitlements.\n        # Attempting to fetch passes in a non-entitled script might result in empty lists or errors.\n        \n        # Example: Check if the current app is allowed to add passes\n        if pass_library.canAddPasses():\n            print(\"This application is authorized to add passes to Wallet.\")\n        else:\n            print(\"This application is not authorized to add passes to Wallet.\")\n\n    else:\n        print(\"PassKit library is not available on this system.\")\n\nif __name__ == \"__main__\":\n    check_passkit_availability()","lang":"python","description":"This quickstart demonstrates how to import the `PassKit` framework and check if the PassKit library is available on the current macOS system. It also shows how to get the shared `PKPassLibrary` instance and check if the application has permission to add passes. Note that full interaction with Wallet passes typically requires the Python script to be run within a properly signed macOS application bundle with the necessary entitlements."},"warnings":[{"fix":"Upgrade Python to 3.10 or newer.","message":"PyObjC 12.0 dropped support for Python 3.9. Users on Python 3.9 or older must upgrade their Python version to use `pyobjc-framework-passkit` 12.0 or newer.","severity":"breaking","affected_versions":">=12.0"},{"fix":"Upgrade Python to 3.9 or newer (Python 3.10+ for PyObjC 12.0+).","message":"PyObjC 11.0 dropped support for Python 3.8. Users on Python 3.8 must upgrade their Python version to use `pyobjc-framework-passkit` 11.0 or newer.","severity":"breaking","affected_versions":">=11.0"},{"fix":"Review Python subclasses of Objective-C classes, especially those overriding `init` methods or manually calling `alloc()`, to ensure correct reference counting and object lifecycle management.","message":"PyObjC 11.1 changed the behavior of 'init' family methods and `NSObject.alloc()` to align with Objective-C's Automatic Reference Counting (ARC) specification. This change affects how references are handled for newly initialized objects and might require reviewing code that manually manages object lifecycle or uses `alloc()` followed by `init` methods.","severity":"breaking","affected_versions":">=11.1"},{"fix":"If subclassing an Objective-C class and relying on PyObjC's default object creation, use Objective-C compatible `init` methods (e.g., `initWith...`) rather than a Python `__init__`.","message":"After PyObjC 10.3, if a Python class subclasses an Objective-C class and relies on PyObjC's default `__new__` implementation (i.e., doesn't define its own `__new__`), it cannot implement `__init__`. While PyObjC 10.3.1 partially reverted this for classes with user-implemented `__new__`, the general rule for relying on PyObjC's `__new__` is to avoid Python `__init__` on those subclasses.","severity":"gotcha","affected_versions":">=10.3"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}