Skip to main content

Simple interactable Mac notifications with only pure-python dependencies

Project description

mac-notifications

Mac supported Python 3.7+ supported


Documentation: https://jorricks.github.io/mac-notifications/

Source Code: https://github.com/Jorricks/mac-notifications


mac-notification is a Python library to make it as easy as possible to create interactable notifications.

Features

  • 🚀 Easy python interface. It's as simple as 'client.create_notification(title="Meeting starts now!", subtitle="Team Standup")'
  • 💥 Ability to add action buttons with callbacks!
  • 📝 Ability to reply to notifications!
  • ⌚ Delayed notifications.
  • ⏱️ Automatically time out the notification listener.
  • 📦 Just two packages (which is really just one package) as a dependency

Installation

To use mac-notifications, first install it using pip:

pip install mac-notifications

Requirements

Python 3.8+

Mac-notification only relies on pyobjc:

  • The PyObjC project aims to provide a bridge between the Python and Objective-C programming languages on macOS.

Example

A simple example. Please look in the docs for more examples.

from pathlib import Path
from mac_notifications import client

client.create_notification(
    title="Meeting starts now!",
    subtitle="Team Standup",
    icon=Path(__file__).parent / "zoom.png",
    action_button_str="Join zoom meeting",
    action_button_callback=partial(join_zoom_meeting, conf_number=zoom_conf_number)
)

Why did you create this library?

I wanted a library that did not depend on any non-python tools (so you had to go around and install that). Instead, I wanted a library where you install the pip packages, and you are done. Later I realised how hard it was to integrate correctly with PyOBJC. Also, I had a hard time finding any examples on how to easily integrate this in a non-blocking fashion with my tool. Hence, I figured I should set it up to be as user-friendly as possible and share it with the world ;)!

Limitations

Although there are some limitations, there is no reason to not use it now :v:.

  • You need to keep your application running while waiting for the callback to happen.
  • Currently, we are only supporting the old deprecated user notifications. Soon we will also make the new implementation available.

Download files

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

Source Distribution

macos-notifications-0.0.1a0.tar.gz (132.9 kB view hashes)

Uploaded Source

Built Distribution

macos_notifications-0.0.1a0-py3-none-any.whl (11.2 kB view hashes)

Uploaded Python 3

Supported by

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