This release is a pre-release and may not be stable for production use.
forge-mvc-notifications
Notifications in-app opt-in pour Forge : créer des notifications destinées aux
utilisateurs (élève inscrit, note publiée, devoir à rendre) dans une table
notifications, les lire, les marquer comme lues.
Périmètre V1 : notifications in-app (des lignes en base, affichées dans l'IHM).
La livraison hors application (email, push) reste à la charge de l'application,
par exemple en combinant ce paquet avec forge-mvc-jobs et forge-mvc-mail.
Installation
pip install --pre forge-mvc-notifications
En développement : pip install -e ./packages/forge-mvc-notifications.
Mise en place de la table
forge notifications:init # copie la migration dans mvc/migrations/
forge migration:apply # crée la table notifications
Utilisation
from forge_mvc_notifications import notify, get_notifications, unread_count, mark_read
notify("eleve.42", "Votre note est publiée", type="info", data={"cours": "maths"})
print(unread_count("eleve.42")) # 1
for n in get_notifications("eleve.42", unread_only=True):
print(n.message, n.created_at)
mark_read(1)
L'API expose notify, get_notifications, unread_count, mark_read,
mark_all_read, plus Notification, NotificationError, TABLE_NAME,
MAX_LIMIT.
Afficher les notifications dans une page
from forge_mvc_notifications import register_notification_routes
register_notification_routes(router, recipient_of=lambda r: destinataire_de(r))
Quatre routes JSON : GET /api/notifications/unread-count,
GET /api/notifications (paginée par curseur), POST /api/notifications/{id}/read
et POST /api/notifications/read-all.
recipient_of est obligatoire. Le destinataire vient de la session, jamais de la
requête : accepter ?recipient=... donnerait à quiconque les notifications de
n'importe qui. Le marquage est borné au même destinataire.
Ces routes rendent du JSON et ne poussent rien ; le rafraîchissement s'écrit avec HTMX, que le squelette livre déjà.
Périmètre
- Stockage in-app uniquement (lignes en base).
- Routes JSON de lecture et de marquage, à câbler explicitement.
- Hors périmètre : livraison email/push (à combiner avec
forge-mvc-jobs+forge-mvc-mail), préférences de notification, poussée temps réel (SSE, WebSocket) et script de rafraîchissement.
Documentation complète : https://forgemvc.com/docs/forge/.
Release files for forge-mvc-notifications 1.0.0rc8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| forge_mvc_notifications-1.0.0rc8.tar.gz | 30.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| forge_mvc_notifications-1.0.0rc8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 49.7 kB
Release files / forge_mvc_notifications-1.0.0rc8.tar.gz
| Download URL | forge_mvc_notifications-1.0.0rc8.tar.gz |
|---|---|
| Size | 30.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
59fa30f656042e9f5934eb2fdf65b6d81f7baf4ebed6eb150ce5f67ed857f6d9
|
|
BLAKE2b-256 checksum How to use checksums |
d9b095bca83c9ab0d1e6cc72a40568c4a49a52753101fa1c5e5baeaf9ad57e46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / forge_mvc_notifications-1.0.0rc8-py3-none-any.whl
| Download URL | forge_mvc_notifications-1.0.0rc8-py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ec6141fec9f6f4e6c0f82f376f4295838be340616cd538ff97bd93161a6adf7
|
|
BLAKE2b-256 checksum How to use checksums |
26a68dc57cd3b8983a860af96f87b10f099646c9827d375f27128066ca429668
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|