PyObjC-framework-NotificationCenter provides Python bindings for Apple's NotificationCenter.framework on macOS, allowing Python applications to interact with the system's user notification services. It primarily wraps the older NSUserNotification API. As part of the larger PyObjC project, it maintains an active development pace, with releases often coinciding with new macOS SDK updates, currently at version 12.1.
pip install pyobjc-framework-notificationcenterVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to send a simple user notification using the `NSUserNotification` and `NSUserNotificationCenter` APIs provided by `NotificationCenter.framework` on macOS. Note that for modern macOS (10.14+), Apple recommends `UserNotifications.framework` (UNUserNotificationCenter), which is available via `pyobjc-framework-UserNotifications`.
Upgrade to a supported Python version (currently >=3.10 for PyObjC 12.1) or pin an older PyObjC version compatible with your Python environment.
Review custom Python subclasses of Objective-C objects, especially those implementing `init` methods, to ensure correct reference handling and avoid memory leaks or crashes.
When subclassing Objective-C classes in Python, be cautious with overriding `__new__` and `__init__`. If `__new__` is not explicitly provided by your class or its Python superclasses, use `__init__` as usual. If you override `__new__`, ensure it correctly calls the superclass's `__new__` or `alloc().init()` pattern.
If using Python 3.13, exercise caution with free-threading when using PyObjC. For critical applications, consider using a non-free-threaded Python build or waiting for more stable PyObjC free-threading support.
For new development or modern macOS applications, consider using `pyobjc-framework-UserNotifications` and its `UNUserNotificationCenter` API instead of `pyobjc-framework-notificationcenter`.