Registry / communication / notify2

notify2

JSON →
library0.3.1pypypiunverified

notify2 is a Python interface to DBus notifications, allowing applications to send desktop notifications via the freedesktop.org Desktop Notifications Specification. It provides a simple API to initialize an application, create notifications with summaries, bodies, and icons, and control their display. The current version is 0.3.1, released in 2017. The project appears to be in maintenance mode, with no new feature development expected.

pip install notify2
INSTALL
IMPORT
SIG · NOTIFY2
N
notify2
communicationpythonv0.3.1
Install
1.5s avg
Import
—
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.3.1 · pip install
no network on importno background threads
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.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

notify2
✓ import notify2
✗ import notify2

This quickstart initializes `notify2`, creates a basic desktop notification with a summary, body, and icon, sets a timeout, and displays it. Requires a running DBus session and a notification daemon (e.g., dunst, xfce4-notifyd) on a Linux desktop environment.

import notify2 import os # Initialize the notification system with your app name # This is required before sending any notifications notify2.init(os.environ.get('NOTIFY_APP_NAME', 'MyPythonApp')) # Create a new notification # Arguments: summary, body (optional), icon (optional) n = notify2.Notification( "Hello from notify2!", "This is a test notification generated by a Python script.", icon='dialog-information' # Example icon name (often from GTK/freedesktop theme) ) # Set a timeout for the notification (in milliseconds) # -1 means 'never expire' (if supported by daemon), 0 means 'default' n.set_timeout(5000) # 5 seconds # Show the notification n.show() print("Notification sent! Check your desktop.")
Debug
Known issues
gotchanotify2 relies on `dbus-python` and a running DBus session along with a compatible desktop notification daemon (e.g., `dunst`, `xfce4-notifyd`, `notification-daemon`) on a Linux desktop environment. If these prerequisites are not met, notifications will either silently fail to appear or raise `DBusException` errors.
fix
Ensure `dbus-python` is installed (`pip install dbus-python`) and a notification daemon is active and configured in your desktop environment. For server-side applications, this library is generally unsuitable.
affects: All versions
deprecatednotify2 is the spiritual successor to the older `pynotify` library. While both interfaces with `libnotify`, `notify2` is generally preferred for modern Python applications and offers a more Pythonic API. If migrating from `pynotify`, expect API changes.
fix
Update import statements and API calls from `pynotify` to `notify2`'s syntax (e.g., `notify2.Notification` instead of `pynotify.Notification`).
affects: Users migrating from `pynotify`
gotchaThe library's last update was in 2017 (version 0.3.1). While it generally remains functional, it might encounter subtle compatibility issues with very recent Python versions (e.g., Python 3.10+) or highly specific modern DBus configurations or desktop environments. It is not actively maintained.
fix
Test `notify2` thoroughly in your target environment. If persistent issues arise, consider exploring alternative notification mechanisms or newer Python libraries if available and maintained.
affects: Potentially Python 3.8+ and newer OS/DE versions
Upgrade
Version history
0.3.1latest on PyPI · released Apr 28, 2017
Audit
Dependencies
dbus-pythonrequiredCore dependency for DBus communication. Required for notifications to function.
Agent activity
34 hits · last 30 days
node
32
OpenAI (training)
1
Resources
notify2 — pip install notify2 · libregistry