{"id":6119,"library":"pyobjc-framework-intentsui","title":"PyObjC IntentsUI Framework","description":"pyobjc-framework-intentsui provides Python wrappers for Apple's IntentsUI framework on macOS. It is part of the PyObjC project, a bidirectional bridge enabling Python scripts to interact with Objective-C libraries, including macOS Cocoa frameworks. 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","GUI","Objective-C","SiriKit","Intents","PyObjC"],"install":[{"cmd":"pip install pyobjc-framework-intentsui","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"This package is a wrapper for a specific macOS framework, requiring the core PyObjC bridge functionality.","package":"pyobjc-core"}],"imports":[{"symbol":"INUIAddVoiceShortcutViewController","correct":"from IntentsUI import INUIAddVoiceShortcutViewController"}],"quickstart":{"code":"from IntentsUI import INUIAddVoiceShortcutViewController\nfrom Foundation import NSObject\n\n# IntentsUI classes like INUIAddVoiceShortcutViewController are typically used within\n# a macOS application's Intents UI Extension, often involving XCode and Interface Builder.\n# A simple standalone Python script usually cannot directly instantiate and display \n# these UI elements without a full application context.\n\n# This example primarily shows the import and a placeholder for where you might use it.\n# For actual usage, refer to Apple's SiriKit documentation and PyObjC examples\n# involving py2app and application development.\n\ndef create_intents_ui_controller():\n    # In a real application, you would instantiate and configure this controller.\n    # For example, to add a voice shortcut:\n    # controller = INUIAddVoiceShortcutViewController.alloc().initWithShortcut_(your_shortcut)\n    # Or, using the Pythonic instantiation (PyObjC 10.4+):\n    # controller = INUIAddVoiceShortcutViewController(shortcut=your_shortcut)\n    print(f\"Successfully imported {INUIAddVoiceShortcutViewController.__name__}.\")\n    print(\"IntentsUI classes require an application context, typically an Intents UI Extension.\")\n    return None\n\nif __name__ == \"__main__\":\n    create_intents_ui_controller()","lang":"python","description":"The IntentsUI framework classes, such as `INUIAddVoiceShortcutViewController`, are designed for building UI within SiriKit Intents UI extensions. A direct, standalone Python quickstart without a full macOS application and Xcode project setup is not practical for demonstrating functional UI. This snippet shows a basic import and explains the typical context of usage."},"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"},{"fix":"Review code that interacts with object initialization, especially custom subclasses or factory methods, to ensure correct reference handling. Explicit memory management is rarely needed in Python, but understanding the underlying Objective-C semantics is crucial for correct behavior.","message":"PyObjC 11.1 changed how initializer methods (`init` family) are modeled, now correctly reflecting that they 'steal' a reference to `self` and return a new one, as per `clang`'s Automatic Reference Counting (ARC) documentation. This affects object lifecycle and reference counting.","severity":"breaking","affected_versions":">=11.1"},{"fix":"Only use `pyobjc-framework-intentsui` in macOS environments. For cross-platform solutions, consider alternative libraries.","message":"PyObjC is a macOS-specific library and will not install or run on other operating systems. The frameworks it wraps (like IntentsUI) are Apple-proprietary.","severity":"gotcha","affected_versions":"All"},{"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"},{"fix":"Favor `MyClass(...)` for new object creation when possible, or `MyClass.alloc().init...()`. If subclassing and overriding `__new__`, ensure `__init__` logic is compatible with the PyObjC bridging rules and refer to the PyObjC instantiation documentation.","message":"PyObjC 10.3 introduced breaking changes in `__init__` and `__new__` handling for Objective-C classes, which was partially reverted in 10.3.1. While `__init__` can now be used when a user implements `__new__`, code relying on PyObjC's provided `__new__` still cannot use `__init__`. The recommended Pythonic instantiation is `MyClass(...)` (available since PyObjC 10.4) or the explicit `MyClass.alloc().init...()`.","severity":"gotcha","affected_versions":">=10.3"},{"fix":"If using Python 3.13's free-threading, proceed with caution and thorough testing, as the feature is still experimental in Python. Ensure you are using PyObjC 12.1 or newer for free-threading support.","message":"Although PyObjC 12.1 and later supports Python 3.13's experimental free-threading, the underlying Python feature itself is experimental. Earlier PyObjC versions (e.g., 10.3) did not support it.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[]}