A package for simplified push notification management.
Project description
Notificator
A developer-friendly package for simplified notification management across internal services. It provides a small domain model and async provider clients for sending email and SMS.
What It Provides
- Async notification clients for email (Mailgun) and SMS (Twilio).
- A shared
NotificationContentvalue object for payload consistency. - A
NotificationClientprotocol to make adapters testable and swappable. - Template and non-template delivery workflows.
Getting Started
Install
# uv
uv add hexed-notificator
# pip
pip install hexed-notificator
Quickstart: Mailgun Email
import asyncio
from notificator import NotificationContent, EmailAddress
from notificator.mail import MailgunClient
async def main() -> None:
mailing_client = MailgunClient(
domain="<MAILGUN_DOMAIN>",
api_key="<MAILGUN_API_KEY>",
sender_email=EmailAddress("no-reply@<YOUR_DOMAIN>"),
sender_display_name="Notificator",
default_subject="Service Notification",
)
await mailing_client.notify(
NotificationContent(body="Hello from Notificator!"),
recipient=EmailAddress("user@example.com"),
)
await mailing_client.aclose()
asyncio.run(main())
Quickstart: Twilio SMS
import asyncio
from notificator import NotificationContent, PhoneNumber
from notificator.sms import TwilioSmsClient, TwilioSmsTemplate
async def main() -> None:
template_with_custom_versioning = TwilioSmsTemplate(
id="shipping_status_template", # Friendly name
version_registry={"en": "temp123_1", "pl": "temp123_2"} # Friendly version name -> sid mapping
)
sms_client = TwilioSmsClient(
account_sid="<TWILIO_ACCOUNT_SID>",
token="<TWILIO_AUTH_TOKEN>",
sender_phone_number=PhoneNumber("+15551234567"),
templates=["temp_123_3", template_with_custom_versioning], # One plain template + a versioned template
)
await sms_client.notify(
NotificationContent(body="Your verification code is 123456."),
recipient=PhoneNumber("+15557654321"),
)
await sms_client.notify_from_template(
template="shipping_status_template",
recipient=PhoneNumber("+15557654321"),
version="en",
status="shipped",
shipping_date="2026-03-01"
)
await sms_client.aclose()
asyncio.run(main())
Template Delivery
await mailing_client.notify_from_template(
template="shipping_status_template",
recipient=EmailAddress("user@example.com"),
order_id="1234",
status="shipped",
)
Documentation
- Build docs:
poe docs - Serve docs locally:
poe docs --serve - API reference is generated via
mkdocstrings.
Linting
Run poe lint to apply formatting and ensure docstrings and typing checks pass.
Contributing
Prerequisites
-
Generate an SSH key and add the SSH key to your GitHub account.
-
Configure SSH to automatically load your SSH keys:
cat << EOF >> ~/.ssh/config Host * AddKeysToAgent yes IgnoreUnknown UseKeychain UseKeychain yes ForwardAgent yes EOF
-
Install VS Code and VS Code's Dev Containers extension. Alternatively, install PyCharm.
-
Optional: install a Nerd Font such as FiraCode Nerd Font and configure VS Code or PyCharm to use it.
Development environments
The following development environments are supported:
-
⭐️ GitHub Codespaces: click on Open in GitHub Codespaces to start developing in your browser.
-
⭐️ VS Code Dev Container (with container volume): click on Open in Dev Containers to clone this repository in a container volume and create a Dev Container with VS Code.
-
⭐️ uv: clone this repository and run the following from root of the repository:
# Create and install a virtual environment uv sync --python 3.14 --all-extras # Activate the virtual environment source .venv/bin/activate # Install the pre-commit hooks pre-commit install --install-hooks
-
VS Code Dev Container: clone this repository, open it with VS Code, and run Ctrl/⌘ + ⇧ + P → Dev Containers: Reopen in Container.
-
PyCharm Dev Container: clone this repository, open it with PyCharm, create a Dev Container with Mount Sources, and configure an existing Python interpreter at
/opt/venv/bin/python.
Developing
- This project follows the Conventional Commits standard to automate Semantic Versioning and Keep A Changelog with Commitizen.
- Run
poefrom within the development environment to print a list of Poe the Poet tasks available to run on this project. - Run
uv add {package}from within the development environment to install a run time dependency and add it topyproject.tomlanduv.lock. Add--devto install a development dependency. - Run
uv sync --upgradefrom within the development environment to upgrade all dependencies to the latest versions allowed bypyproject.toml. Add--only-devto upgrade the development dependencies only. - Run
cz bumpto bump the package's version, update theCHANGELOG.md, and create a git tag. Then push the changes and the git tag withgit push origin main --tags.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hexed_notificator-0.4.0.tar.gz.
File metadata
- Download URL: hexed_notificator-0.4.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f86f147f10c2a4d890ad0bc36dfe8a7939b6381839eade88c0a122fd07df641f
|
|
| MD5 |
b0d01e2ece4f41c78601f86e5e9ec3ed
|
|
| BLAKE2b-256 |
e17d294899501a6c5c7ace45965a161f67625b308525e9112386b2b2feb8e2a4
|
File details
Details for the file hexed_notificator-0.4.0-py3-none-any.whl.
File metadata
- Download URL: hexed_notificator-0.4.0-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56433af8ec9df01dd17fdbf700c98e287ed3da409cbb48a34df8ef2659a85c0c
|
|
| MD5 |
8f54308f7ba93c7b7197fee623acde33
|
|
| BLAKE2b-256 |
c7bc86c68eab70455c41aee10d541430623ce705ed6cb2e774eeb195d067f23b
|