Registry / communication / pyobjc-framework-notificationcenter

pyobjc-framework-notificationcenter

JSON →
library12.2pypypiunverified

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-notificationcenter
INSTALL
IMPORT
SIG · PYOBJC-FRAMEWORK-N
P
pyobjc-framework-notificationcenter
communicationpythonv12.2
Install
—
Import
—
Disk
—
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.940 runs
build_error
glibc
py 3.10–3.940 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

NSUserNotificationCenter, NSUserNotification
✓ from Foundation import NSDate from NotificationCenter import NSUserNotification, NSUserNotificationCenter
For using the NSUserNotificationCenter and NSUserNotification APIs. For newer UserNotifications.framework (macOS 10.14+), use `pyobjc-framework-UserNotifications` and import from `UserNotifications`.

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`.

import objc from Foundation import NSDate from NotificationCenter import NSUserNotification, NSUserNotificationCenter import time # Create a notification notification = NSUserNotification.alloc().init() notification.setTitle_("PyObjC Notification") notification.setInformativeText_("This is a test notification from NotificationCenter.framework.") notification.setDeliveryDate_(NSDate.dateWithTimeIntervalSinceNow_(0)) # Deliver immediately # Set an identifier to avoid duplicate notifications in Notification Center (optional, but good practice) notification.setIdentifier_(f"com.example.pyobjc.notification.{time.time()}") # Get the default notification center and deliver the notification notificationCenter = NSUserNotificationCenter.defaultUserNotificationCenter() notificationCenter.deliverNotification_(notification) print("Notification delivered. Check your macOS Notification Center.") # In a real application, you might need to run an event loop # For simple scripts, exiting is usually sufficient as the notification # delivery is handled by the system.
Debug
Known issues
breakingPyObjC frequently drops support for older Python versions. Version 12.0 dropped Python 3.9, and version 11.0 dropped Python 3.8. Always verify Python compatibility for your specific PyObjC version.
fix
Upgrade to a supported Python version (currently >=3.10 for PyObjC 12.1) or pin an older PyObjC version compatible with your Python environment.
affects: >=11.0
breakingMajor changes to PyObjC's Automatic Reference Counting (ARC) behavior, particularly for initializer (`init`) methods. PyObjC now correctly models that methods in the 'init' family steal a reference to self and return a new reference, aligning with Clang's ARC documentation.
fix
Review custom Python subclasses of Objective-C objects, especially those implementing `init` methods, to ensure correct reference handling and avoid memory leaks or crashes.
affects: >=11.1
gotchaInteractions between Python's `__init__` and `__new__` methods and Objective-C object creation can be tricky. PyObjC 10.3 initially removed `__init__` support when PyObjC's `__new__` was used, which was partially re-introduced in 10.3.1.
fix
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.
affects: >=10.3
gotchaExperimental support for Python 3.13's free-threading (PEP 703) was introduced in PyObjC 11.0, but PyObjC 10.3 explicitly did not support it. Using PyObjC in a free-threaded environment may introduce instability or unexpected behavior.
fix
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.
affects: >=10.3
deprecatedThe `NSUserNotificationCenter` API, wrapped by this framework, is deprecated on macOS 10.14 and later in favor of `UserNotifications.framework` (`UNUserNotificationCenter`). While still functional, Apple recommends migrating to the newer API for future compatibility and features.
fix
For new development or modern macOS applications, consider using `pyobjc-framework-UserNotifications` and its `UNUserNotificationCenter` API instead of `pyobjc-framework-notificationcenter`.
affects: macOS 10.14+
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredCore bridge for Python and Objective-C, required by all PyObjC frameworks.
pyobjc-framework-CocoarequiredProvides fundamental Objective-C classes (like NSObject, NSDate) from Foundation.framework, which NotificationCenter often relies on.
Agent activity
11 hits · last 30 days
node
8
OpenAI (training)
2
Resources
pyobjc-framework-notificationcenter — pip install pyobjc-framework-notificationcenter · libregistry