Skip to main content

Decorator and context manager for desktop notifications when Python jobs finish.

Project description

Auto Notifier (Desktop MVP)

Easily notify yourself of task completion or failure in Python scripts with Auto Notifier. Ideal for monitoring long-running jobs or automating workflows. Delivers native desktop notifications using notify-py; future support for other channels is planned.

Install from PyPI (or a local source distribution) and the required notify-py dependency will be pulled in automatically:

pip install auto-notifier

Alternatively, you can include the auto_notifier directory in your project and add it to your PYTHONPATH; in that case you must ensure notify-py is available in the runtime environment.

Usage

Decorator

Use the notify_when_done decorator to wrap a long-running function. When the function returns successfully, a desktop notification will be sent indicating completion and the elapsed time. If the function raises an exception, a failure notification will be sent instead and the exception will be re-raised.

from auto_notifier import notify_when_done

@notify_when_done(
    title="Training finished",
    message="The model training completed successfully",
    error_title="Training failed",
)
def train_model():
    # long running code here
    ...

train_model()  # will send a desktop notification when done or on error

Context manager

You can also wrap arbitrary code using the notify_on_complete context manager:

from auto_notifier import notify_on_complete

with notify_on_complete(title="Processing done"):
    # long running block here
    ...

When the block exits, a desktop notification is sent indicating success or failure.

Configuration

Both the decorator and context manager accept optional keyword arguments that are passed directly to notifypy.Notify (for example, app_name or icon_path). Refer to the notify-py documentation for details. A minimal example from the upstream library shows how to instantiate the notifier and send a message:

from notifypy import Notify
notification = Notify()
notification.title = "Cool Title"
notification.message = "Even cooler message."
notification.send()  # sends a desktop notification on your platform

This library uses the same API under the hood.

Limitations

  • This version only supports desktop notifications via notify-py. To receive notifications over other channels (Slack, email, etc.), additional integrations will need to be implemented in future versions.
  • Desktop notifications may not display on headless servers or restricted environments. In such cases, you may wish to extend the send_notification function to log messages or use another backend.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

auto_notifier-0.1.0.tar.gz (2.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

auto_notifier-0.1.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file auto_notifier-0.1.0.tar.gz.

File metadata

  • Download URL: auto_notifier-0.1.0.tar.gz
  • Upload date:
  • Size: 2.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for auto_notifier-0.1.0.tar.gz
Algorithm Hash digest
SHA256 df4bfa06b61aa1a3f84561d96b339022a9f7aee5127e54e47c4bf03ab21406af
MD5 228d3a3bb486a0d0f25d8020107874c5
BLAKE2b-256 8aaf8a6d4c951f6423a95aa585d291ace8296aa83c79ac721917aced03011308

See more details on using hashes here.

File details

Details for the file auto_notifier-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: auto_notifier-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for auto_notifier-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7931f1b3eec9b5248219dc40b03388a5b16535d1ae3a566687124f2afbd5bcfd
MD5 6a372823c9614330fcb7fdb915606fa6
BLAKE2b-256 b117218169c1dbbc271fe7d6a31dae3a4461c00f2935503072c33a5f4badc180

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page