Bazis Notify
Stored notifications of the users for the Bazis framework: an inbox API of the user's own notifications, live delivery of the new ones over bazis-ws and an optional e-mail channel through the mail backend of the Bazis core.
Quick Start
uv add 'bazis-notify[ws]' # without [ws]: stored and e-mailed only
# project.env: BS_INSTALLED_APPS='[..., "bazis.contrib.notify"]', then migrate
# the router module of the project (BS_BAZIS_ROUTER_MODULE)
router = BazisRouter(prefix='/api/v1')
router.register('bazis.contrib.ws.router') # live delivery (optional)
router.register('bazis.contrib.notify.router') # /api/v1/notify/notification/
# <app>/notifications.py: the notification types of the app
from bazis.contrib.notify.registry import register
register('billing.purchase_declined', title=_('Purchase declined'), severity='error',
action={'route': '/settings/billing'})
# in the hooks of a write, a transit or a background task
from bazis.contrib.notify.service import notify
notify(order.customer, 'billing.purchase_declined',
_('Payment for %(product)s declined'), _('No credits were charged.'),
params={'product': order.product.name}, dedupe_key=f'declined:{order.pk}', email=True)
What it does
- Storage: one
Notificationper recipient (notification_type,title,body,action,metadata,read_at,dedupe_key,dt_created), immutable exceptread_at; texts rendered in the language of each recipient; metadata without secrets; at most one notification per user anddedupe_key. - Types: registered by the apps (
slug,category,severity, defaultaction); an unknown type is refused. - API (own notifications only, 401 without a valid token): list with
filter=is_read=false,filter=notification_type=...and pagination, retrieve,PATCH read_at(read / unread, the time is the server's),DELETE,GET unread_count/,POST read_all/,POST clear/. - Live: with bazis-ws,
notification_createdandnotifications_changed(with the unread count) on the channel of the user after the commit. - E-mail:
email=Truesends after the commit, one connection per call (a refused address is logged, the others are sent), through the default mailer configured byBAZIS_EMAIL_*. - Fan-out:
notify_all(queryset, ...)in batches from a bazis-bg task, idempotent with adedupe_key. - Retention:
BAZIS_NOTIFY_RETENTION_DAYSanddelete_expired()for a periodic task.
The full guide is bazis/contrib/notify/AGENTS.md.
License
Apache License 2.0.
Metadata
Release files for bazis-notify 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bazis_notify-0.1.0.tar.gz | 38.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bazis_notify-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 63.9 kB
Release files / bazis_notify-0.1.0.tar.gz
| Download URL | bazis_notify-0.1.0.tar.gz |
|---|---|
| Size | 38.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4b80b9e63d2607720ec1dfc8ca0011deb30f63719c4cb8f1a6a0bc774bfb0e6
|
|
BLAKE2b-256 checksum How to use checksums |
11d8757e89a0c2402777c9d94cabe67e0470b13a8018a71427e7f2129a43a45f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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}
|
Release files / bazis_notify-0.1.0-py3-none-any.whl
| Download URL | bazis_notify-0.1.0-py3-none-any.whl |
|---|---|
| Size | 25.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85e0930346ce75c0abe0c469eb36ed194581f56d5f42d0a7a405b1ee2338fe1a
|
|
BLAKE2b-256 checksum How to use checksums |
9568d142431a49fc5062455a6a84c2d549c08062dfb742ab1440e9642454ea77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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}
|