{"library":"pyobjc-framework-localauthenticationembeddedui","title":"PyObjC LocalAuthenticationEmbeddedUI Framework","description":"This library provides Python wrappers for Apple's LocalAuthenticationEmbeddedUI framework on macOS. It's part of the larger PyObjC project, which serves as a bridge between Python and Objective-C, enabling Python scripts to interact with and extend macOS Cocoa libraries. The project is actively maintained with frequent releases.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pyobjc-framework-localauthenticationembeddedui"],"cli":null},"imports":["from LocalAuthenticationEmbeddedUI import LAAuthenticationView","from LocalAuthenticationEmbeddedUI import LAAuthenticationViewDelegate","from LocalAuthentication import LAContext"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import objc\nfrom AppKit import NSApplication, NSWindow, NSView, NSRect, NSButton, NSAppDelegate, NSApp\nfrom Foundation import NSObject, NSSelectorFromString, NSLog\nfrom LocalAuthenticationEmbeddedUI import LAAuthenticationView, LAAuthenticationViewDelegate\nfrom LocalAuthentication import LAContext, LAPolicy, LAError\n\n\nclass AuthenticationDelegate(NSObject, LAAuthenticationViewDelegate):\n    def authenticationView_didCompleteWithResult_error_(self, view, result, error):\n        if error:\n            NSLog(f\"Authentication failed with error: {error.localizedDescription()}\")\n            if error.code() == LAError.UserCancel: # LAError.UserCancel is part of LAError, not LAError.Code.UserCancel\n                NSLog(\"User cancelled authentication.\")\n        elif result:\n            if result == 1: # Assuming LAAuthenticationResult.Success is 1. Check Apple docs for exact enum values.\n                NSLog(\"Authentication successful!\")\n            else:\n                NSLog(\"Authentication completed with unknown result.\")\n        else:\n            NSLog(\"Authentication completed, but no result or error.\")\n\n\nclass AppDelegate(NSObject):\n    def applicationDidFinishLaunching_(self, notification):\n        # Create a window\n        self.window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(\n            NSRect((200, 300), (400, 200)),\n            (1 << 0 | 1 << 1 | 1 << 3 | 1 << 8), # Titled, Closable, Miniaturizable, Resizable\n            2, # NSBackingStoreBuffered\n            False\n        )\n        self.window.setTitle_(\"PyObjC LAEmbeddedUI Example\")\n        self.window.makeKeyAndOrderFront_(None)\n\n        # Create a content view\n        content_view = NSView.alloc().init().autorelease()\n        self.window.setContentView_(content_view)\n\n        # Create LAAuthenticationView\n        self.auth_view = LAAuthenticationView.alloc().initWithFrame_(NSRect((50, 50), (300, 100)))\n        content_view.addSubview_(self.auth_view)\n\n        # Set delegate and context\n        self.delegate = AuthenticationDelegate.alloc().init()\n        self.auth_view.setDelegate_(self.delegate)\n\n        # Create LAContext (from LocalAuthentication framework)\n        self.la_context = LAContext.alloc().init()\n        self.auth_view.setContext_(self.la_context)\n\n        # Start authentication (LAAuthenticationView will start when added to view hierarchy with context)\n        # It might also need an explicit call like evaluatePolicy_localizedReason_reply_ from LAContext\n        # but for embedded UI, setting the context and delegate is often enough to trigger its display.\n        NSLog(\"LAAuthenticationView added. Awaiting user interaction.\")\n\n\nif __name__ == '__main__':\n    app = NSApplication.sharedApplication()\n    delegate = AppDelegate.alloc().init()\n    NSApp().setDelegate_(delegate)\n    app.run()","lang":"python","description":"This quickstart demonstrates how to instantiate and use `LAAuthenticationView` for embedded biometric authentication within a basic macOS Cocoa application. It sets up an `NSApplication`, a window, and integrates the `LAAuthenticationView` with a custom delegate to handle authentication results. Note that `LAAuthenticationView` requires a running macOS application context to be visible and functional. The `LAContext` object is imported from the `LocalAuthentication` framework, which works in conjunction with the UI component. The exact enum values for `LAAuthenticationResult` might need to be verified against Apple's latest documentation.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":null,"pypi_latest":"12.1","is_stale":null,"summary":{"python_range":"3.10–3.9","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pyobjc-framework-localauthenticationembeddedui","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pyobjc-framework-localauthenticationembeddedui","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.4,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pyobjc-framework-localauthenticationembeddedui","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pyobjc-framework-localauthenticationembeddedui","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.1,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pyobjc-framework-localauthenticationembeddedui","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pyobjc-framework-localauthenticationembeddedui","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.1,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pyobjc-framework-localauthenticationembeddedui","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pyobjc-framework-localauthenticationembeddedui","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.6,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pyobjc-framework-localauthenticationembeddedui","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pyobjc-framework-localauthenticationembeddedui","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.8,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}