{"library":"pyobjc-framework-usernotificationsui","title":"User Notifications UI Framework (PyObjC)","description":"PyObjC is a bridge between Python and Objective-C, allowing Python scripts to use and extend existing Objective-C class libraries, including Cocoa frameworks on macOS. The `pyobjc-framework-usernotificationsui` package provides Python wrappers for the macOS UserNotificationsUI framework. This framework enables developers to customize the appearance and interactivity of local and remote notifications by adding a notification content app extension to their macOS applications. The current version is 12.1, and PyObjC generally follows an annual release cadence, typically in October.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pyobjc-framework-usernotificationsui"],"cli":null},"imports":["from UserNotificationsUI import UNNotificationContentExtension","from Foundation import UNNotification","from AppKit import NSViewController"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import objc\nfrom AppKit import NSViewController\nfrom Foundation import NSObject, NSLog, UNNotification\nfrom UserNotificationsUI import UNNotificationContentExtension\n\nclass MyNotificationViewController (NSObject, NSViewController, UNNotificationContentExtension):\n    \"\"\"\n    This class defines a custom view controller for a rich notification.\n    It runs as part of a macOS Notification Content Extension.\n    This code is illustrative and not directly runnable as a standalone script.\n    It requires an Xcode project with a Notification Content Extension target\n    configured to use this Python class as its principal class.\n    \"\"\"\n\n    # @objc.IBOutlet('myLabel') # Example if using a NIB/Storyboard\n    # myLabel = objc.ivar.IBOutlet()\n\n    def viewDidLoad(self):\n        super().viewDidLoad()\n        NSLog(\"MyNotificationViewController: viewDidLoad called!\")\n        # Access your UI elements here, if loaded from NIB/Storyboard\n        # if self.myLabel:\n        #    self.myLabel.setStringValue_(\"Hello from PyObjC notification!\")\n\n    def didReceiveNotification_(self, notification: UNNotification):\n        \"\"\"\n        Called when a new notification arrives for the extension to display.\n        \"\"\"\n        content = notification.request().content()\n        NSLog(f\"Received notification with title: {content.title()}, body: {content.body()}\")\n        # Update your custom UI elements based on the notification content\n        # if self.myLabel:\n        #    self.myLabel.setStringValue_(content.body())\n\n    def didReceiveNotificationResponse_completionHandler_(self, response, completionHandler):\n        \"\"\"\n        Called when the user interacts with your custom notification UI (e.g., clicks a button).\n        \"\"\"\n        NSLog(f\"Received response for action: {response.actionIdentifier()} with text: {response.userText()}\")\n        # Perform actions based on user interaction\n        completionHandler(UNNotificationContentExtension.UNNotificationContentExtensionResponseOptionDoNotDismiss)\n\n# To integrate this, you would typically build a macOS application with py2app\n# and include a Notification Content Extension target in Xcode that points to\n# this Python code as its principal class.","lang":"python","description":"This quickstart demonstrates the basic structure for a Python class using `pyobjc-framework-usernotificationsui` to define a custom notification content extension. This framework is specifically for customizing the *appearance* and *interactivity* of notifications within a dedicated app extension, not for sending notifications. The code must be integrated into a macOS app extension project, typically set up via Xcode, where this Python class would act as the `UNNotificationContentExtension`'s view controller. It cannot be run as a standalone script.","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-usernotificationsui","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-usernotificationsui","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.9,"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-usernotificationsui","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-usernotificationsui","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-usernotificationsui","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-usernotificationsui","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3,"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-usernotificationsui","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-usernotificationsui","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.7,"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-usernotificationsui","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-usernotificationsui","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.6,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}