PyObjC SecurityInterface Framework
This library provides Python wrappers for the `SecurityInterface` framework on macOS, allowing Python applications to integrate with macOS security UI components. It's part of the larger PyObjC project, bridging Python and Objective-C. The current version is 12.1, and releases are frequent, typically aligning with new macOS SDK updates and Python version support changes.
Warnings
- breaking PyObjC dropped support for Python 3.9 in version 12.0 and Python 3.8 in version 11.0. Older PyObjC versions will not install on newer Python versions and vice-versa.
- breaking Version 11.1 introduced significant changes to how PyObjC handles Automatic Reference Counting (ARC) for initializer methods, aligning with `clang`'s documentation. This can affect custom Objective-C integration and memory management in Python subclasses.
- gotcha PyObjC framework packages, including `pyobjc-framework-securityinterface`, are macOS-specific and will not work on other operating systems. They directly wrap Apple's system frameworks.
- gotcha The functionality exposed by `pyobjc-framework-securityinterface` is directly tied to the macOS SDK version it was compiled against. Newer macOS features or deprecated APIs may lead to differing behavior or availability across macOS versions.
- breaking Changes in how PyObjC handles `__init__` when a user-defined `__new__` exists (v10.3 initially broke it, v10.3.1 partially reverted). If you are subclassing Objective-C classes in Python and overriding `__new__` and `__init__`, review the behavior.
Install
-
pip install pyobjc-framework-securityinterface
Imports
- SFAuthorizationView
from SecurityInterface import SFAuthorizationView
Quickstart
import objc
from SecurityInterface import SFAuthorizationView
# Instantiate a SecurityInterface UI component
auth_view = SFAuthorizationView.alloc().init()
print(f"Successfully instantiated: {auth_view}")
print(f"Type: {type(auth_view)}")
print(f"Objective-C class: {auth_view.pyobjc_class__}")
# Note: For actual UI display and interaction, you would need
# to initialize an NSApplication and run its event loop (e.g., using AppKit or PyObjCTools.AppHelper).
# This quickstart only demonstrates successful import and instantiation.