sdnotify provides a pure Python implementation of systemd's service notification protocol (sd_notify). It allows Python services to communicate their status, readiness, and other information back to systemd, enabling robust service management. The current version is 0.3.2, with releases being infrequent, primarily for packaging or minor internal improvements.
pip install sdnotifyVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize `SystemdNotifier` and send status messages, including `READY=1` and `STATUS` updates, to systemd. This script should be run as a `Type=notify` service under systemd to observe the notifications.
Ensure your systemd unit file is configured with `Type=notify` and that the service is started correctly by systemd, allowing `NOTIFY_SOCKET` to be inherited by your Python process.
Always send `notifier.notify('READY=1')` once your service is fully initialized and ready to accept requests. This is crucial for proper service lifecycle management by systemd.Upgrade to `0.3.0` or later to ensure stable and working functionality with the standard systemd notification protocol.
Install the package using pip: `pip install sdnotify`.
In your `.service` unit file, ensure `Type=notify` is set. In your Python code, confirm that `notifier.notify('READY=1')` is called after all initialization steps are complete.No dependency data recorded yet.