Notify-py
Notify-py is a cross-platform Python library designed for sending desktop notifications on Windows, macOS, and Linux. It simplifies the process of displaying alerts, messages, and system notifications from Python scripts and applications. Currently at version 0.3.43, the library is actively maintained with frequent patch releases addressing bug fixes and minor improvements.
Common errors
-
notifypy.exceptions.UnsupportedPlatform: This version of Windows (11) is not supported.
cause This error occurred on Windows 11 with Python 3.12 in `notify-py` versions prior to `0.3.43` due to an incompatibility with the Windows notification backend.fixUpgrade `notify-py` to version `0.3.43` or newer using `pip install --upgrade notify-py`. -
TypeError: Notify.__init__() got an unexpected keyword argument 'override_detected_notification_system'
cause Attempting to pass a custom notifier object using the `override_detected_notification_system` keyword argument in versions 0.3.0 or later, after the argument was repurposed.fixUse the correct keyword argument `use_custom_notifier` when passing a custom notifier object. The `override_detected_notification_system` argument should now be used to pass a string representing a custom platform name. -
No logging messages from notify-py are appearing in console or logs.
cause By default, `notify-py` disables its internal logging to prevent excessive output, especially in production environments.fixTo enable logging for debugging or verbose output, initialize the `Notify` object with `enable_logging=True`, like `notification = Notify(enable_logging=True)`.
Warnings
- breaking The `override_detected_notification_system` keyword argument was repurposed in v0.3.0. It now accepts a custom platform name (string) instead of a custom notifier object.
- gotcha On macOS, custom icons cannot be set dynamically for notifications. You must bundle a customized version of the notifier with your custom icon to display it.
- gotcha Notify-py notifications are purely informational and do not support interactive elements like buttons or custom actions.
- gotcha Logging within `notify-py` is disabled by default to minimize output. If you need to see internal library logs (e.g., for debugging), it must be explicitly enabled.
Install
-
pip install notify-py
Imports
- Notify
from notifypy import Notify
Quickstart
from notifypy import Notify notification = Notify() notification.title = "My Application Alert" notification.message = "This is a test notification from notify-py!" # Optional: Set an icon (path to .png) and sound (path to .wav) # notification.icon = "/path/to/my_icon.png" # notification.audio = "/path/to/my_sound.wav" # To prevent blocking the main thread (runs notification in background): # notification.send(block=False) notification.send()