pyobjc-framework-photosui provides Python bindings for Apple's PhotosUI framework on macOS, allowing Python developers to interact with system-level Photos user interface components. It is part of the larger PyObjC project, which acts as a bridge between Python and Objective-C. The library is actively maintained, with version 12.1 being the latest stable release, and it generally releases new versions in conjunction with major macOS SDK updates.
pip install pyobjc-framework-photosuiVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import the `PhotosUI` framework and access a class within it. Most `PhotosUI` functionalities require a running Cocoa application, typically managed via `AppKit.NSApplication`. This snippet initializes the shared application (without starting its run loop) and attempts to access `PHLivePhotoView` to confirm the bindings are loaded. Full UI interactions would require more extensive setup.
Upgrade to Python 3.10 or later for PyObjC 12.x, or Python 3.9 or later for PyObjC 11.x. Always use a Python version supported by your PyObjC version.
Existing code should review object instantiation patterns, especially custom subclasses of Objective-C classes, to ensure correct reference handling, though PyObjC manages most ARC complexities internally. This primarily affects advanced users subclassing Objective-C objects.
If implementing `__new__` in a Python subclass of an Objective-C class, ensure `__init__` is not called if `__new__` is meant to handle object initialization entirely, or structure your class hierarchy to avoid conflicts. Refer to PyObjC documentation on object instantiation.
Migrate away from IMServicePlugIn to current Apple APIs if your application relies on this functionality. This warning is specific to the `pyobjc-framework-IMServicePlugIn` package, but is a relevant major version change within the broader PyObjC ecosystem.
Run `xcode-select --install` in your terminal to ensure the command line tools are present.
When `ClassName(...)` doesn't work as expected, explicitly use `ClassName.alloc().init(...)` or `ClassName.alloc().initWithArgument(...)` patterns. Consult Apple's Objective-C documentation for the specific class's initialization methods.