django-loknotify 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_loknotify-0.1.0.dist-info/METADATA +127 -0
- django_loknotify-0.1.0.dist-info/RECORD +64 -0
- django_loknotify-0.1.0.dist-info/WHEEL +5 -0
- django_loknotify-0.1.0.dist-info/licenses/LICENSE +674 -0
- django_loknotify-0.1.0.dist-info/top_level.txt +1 -0
- loknotify/__init__.py +44 -0
- loknotify/admin.py +561 -0
- loknotify/applications.py +32 -0
- loknotify/apps.py +18 -0
- loknotify/checks.py +180 -0
- loknotify/conf.py +122 -0
- loknotify/config/__init__.py +127 -0
- loknotify/config/resolver.py +361 -0
- loknotify/config/runtime.py +178 -0
- loknotify/config/schema.py +262 -0
- loknotify/crypto.py +74 -0
- loknotify/dispatch/__init__.py +52 -0
- loknotify/dispatch/celery.py +18 -0
- loknotify/dispatch/celery_tasks.py +12 -0
- loknotify/dispatch/sync.py +12 -0
- loknotify/dispatch/threadpool.py +50 -0
- loknotify/engine.py +305 -0
- loknotify/events.py +419 -0
- loknotify/exceptions.py +54 -0
- loknotify/filters.py +87 -0
- loknotify/formatting/__init__.py +5 -0
- loknotify/formatting/pipeline.py +144 -0
- loknotify/formatting/renderer.py +211 -0
- loknotify/maintenance.py +71 -0
- loknotify/management/__init__.py +0 -0
- loknotify/management/commands/__init__.py +0 -0
- loknotify/management/commands/loknotify_config.py +53 -0
- loknotify/management/commands/loknotify_emit.py +32 -0
- loknotify/management/commands/loknotify_prune.py +16 -0
- loknotify/management/commands/loknotify_retry_pending.py +14 -0
- loknotify/management/commands/loknotify_test_channel.py +37 -0
- loknotify/migrations/0001_initial.py +297 -0
- loknotify/migrations/__init__.py +0 -0
- loknotify/models.py +242 -0
- loknotify/permissions.py +198 -0
- loknotify/policy.py +158 -0
- loknotify/providers/__init__.py +183 -0
- loknotify/providers/base.py +236 -0
- loknotify/providers/console.py +56 -0
- loknotify/providers/discord.py +437 -0
- loknotify/providers/http.py +102 -0
- loknotify/providers/mailgun.py +368 -0
- loknotify/py.typed +0 -0
- loknotify/schedule.py +161 -0
- loknotify/sender.py +128 -0
- loknotify/services.py +809 -0
- loknotify/signals.py +13 -0
- loknotify/templates/admin/loknotify/choose_provider.html +19 -0
- loknotify/templates/admin/loknotify/event_reference.html +20 -0
- loknotify/templates/admin/loknotify/preview.html +19 -0
- loknotify/templates/admin/loknotify/rule_change_form.html +6 -0
- loknotify/templates/loknotify/preview/discord_embed.html +22 -0
- loknotify/templates/loknotify/preview/email.html +13 -0
- loknotify/templates/loknotify/preview/json.html +1 -0
- loknotify/templates/loknotify/preview/text.html +1 -0
- loknotify/testing.py +132 -0
- loknotify/types.py +207 -0
- loknotify/urls.py +36 -0
- loknotify/views.py +369 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: django-loknotify
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Reusable Django notification framework with pluggable providers (Discord, Mailgun, and more), rules, previews, and layered configuration
|
|
5
|
+
Author-email: Loknus Labs LLC <loknuslabs@gmail.com>
|
|
6
|
+
License-Expression: GPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/loknuslabs/django-loknotify
|
|
8
|
+
Project-URL: Documentation, https://github.com/loknuslabs/django-loknotify#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/loknuslabs/django-loknotify
|
|
10
|
+
Keywords: django,notifications,discord,mailgun,webhooks
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Web Environment
|
|
13
|
+
Classifier: Framework :: Django
|
|
14
|
+
Classifier: Framework :: Django :: 6.0
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Communications
|
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
21
|
+
Requires-Python: >=3.13
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: Django>=6.0.6
|
|
25
|
+
Requires-Dist: djangorestframework>=3.17.1
|
|
26
|
+
Requires-Dist: requests>=2.32.0
|
|
27
|
+
Requires-Dist: cryptography>=44.0.0
|
|
28
|
+
Provides-Extra: celery
|
|
29
|
+
Requires-Dist: celery>=5.4.0; extra == "celery"
|
|
30
|
+
Provides-Extra: example
|
|
31
|
+
Requires-Dist: gunicorn>=23.0.0; extra == "example"
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: black==26.10.1; extra == "dev"
|
|
34
|
+
Requires-Dist: flake8>=7.3.0; extra == "dev"
|
|
35
|
+
Requires-Dist: mypy>=1.19.0; extra == "dev"
|
|
36
|
+
Requires-Dist: django-stubs>=5.2.0; extra == "dev"
|
|
37
|
+
Requires-Dist: djangorestframework-stubs>=3.16.0; extra == "dev"
|
|
38
|
+
Requires-Dist: types-requests; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest>=9.0.3; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-django>=4.12.0; extra == "dev"
|
|
41
|
+
Requires-Dist: responses>=0.25.0; extra == "dev"
|
|
42
|
+
Requires-Dist: pip-audit>=2.10.0; extra == "dev"
|
|
43
|
+
Requires-Dist: build; extra == "dev"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
# django-loknotify
|
|
47
|
+
|
|
48
|
+
A reusable Django notification framework. Your app decides **which events exist**, **which providers can deliver
|
|
49
|
+
them** (Discord and Mailgun are bundled; add your own), **who may send**, and **how messages look**. Administrators
|
|
50
|
+
then connect channels, write rules for when they fire, preview the message, and send tests, all inside the limits the
|
|
51
|
+
host app sets.
|
|
52
|
+
|
|
53
|
+
- Provider-agnostic: a small `Provider` class is all a new channel (Slack, Teams, SMS, ...) needs.
|
|
54
|
+
- Domain-agnostic: no built-in business events. You register your own with `register_event`.
|
|
55
|
+
- Layered configuration: defaults, settings and environment variables, an optional host config source, then the
|
|
56
|
+
admin database. Admins can only narrow or tune inside the host ceiling, and the host can lock any setting.
|
|
57
|
+
- Optional multi-user mode: non-admin users manage their own channels and preferences under a host policy.
|
|
58
|
+
It is off by default.
|
|
59
|
+
- Safe by default: encrypted channel secrets, SSRF guards, mention and header-injection protection, redacted logs,
|
|
60
|
+
rate limits, retry with backoff, and automatic channel disabling.
|
|
61
|
+
- Interfaces: DRF API, generated Django admin screens, and management commands.
|
|
62
|
+
|
|
63
|
+
## Install
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install django-loknotify # add [celery] for the Celery dispatcher
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
# settings.py
|
|
71
|
+
INSTALLED_APPS = [..., "rest_framework", "loknotify"]
|
|
72
|
+
|
|
73
|
+
# urls.py
|
|
74
|
+
path("api/", include("loknotify.urls")),
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
python manage.py migrate
|
|
79
|
+
python manage.py check
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Quick start
|
|
83
|
+
|
|
84
|
+
Register an event (anywhere that loads at startup, or in a `loknotify_events.py` module in any installed app):
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from loknotify import register_event
|
|
88
|
+
|
|
89
|
+
register_event(
|
|
90
|
+
"order.paid",
|
|
91
|
+
label="Order paid",
|
|
92
|
+
context={"order_id": "string", "total": "float"},
|
|
93
|
+
filterable=["total"],
|
|
94
|
+
sample_context={"order_id": "A-1001", "total": 49.5},
|
|
95
|
+
default_templates={"discord": {"embed_title": "Order {{ order_id }} paid"}},
|
|
96
|
+
)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Emit it from your code:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from loknotify import emit
|
|
103
|
+
|
|
104
|
+
emit("order.paid", application="my-shop", context={"order_id": "A-1001", "total": 49.5})
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
In the Django admin, add a channel (for example a Discord webhook), add a rule for `order.paid`, preview it, and send
|
|
108
|
+
a test. See `example/` for a runnable host project and [docs/GUIDE.md](docs/GUIDE.md) for everything else.
|
|
109
|
+
|
|
110
|
+
## Documentation
|
|
111
|
+
|
|
112
|
+
- [docs/README.md](docs/README.md): concepts and how a notification travels from `emit()` to the provider.
|
|
113
|
+
- [docs/GUIDE.md](docs/GUIDE.md): configuration reference, providers, formatting, multi-user mode, API, commands,
|
|
114
|
+
deployment, and "Writing a provider".
|
|
115
|
+
|
|
116
|
+
## Development
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
py -3.13 -m venv .venv
|
|
120
|
+
.venv\Scripts\python -m pip install -e ".[dev]"
|
|
121
|
+
.venv\Scripts\python -m pytest loknotify/tests -q
|
|
122
|
+
.venv\Scripts\python -m black loknotify example && .venv\Scripts\python -m flake8 loknotify example
|
|
123
|
+
.venv\Scripts\python -m mypy
|
|
124
|
+
.venv\Scripts\python manage.py check # runs the example project in example/
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
License: GPL-3.0-or-later.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
django_loknotify-0.1.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
2
|
+
loknotify/__init__.py,sha256=N88Rjo3HD5IcY_TMGgtCmmTJdlJAzq1hCB9F3xll6gs,1450
|
|
3
|
+
loknotify/admin.py,sha256=pSw0BaS0-SLRAhX1Yw0CEeMP2lBKc5ZXhW8cmAvQa4k,25232
|
|
4
|
+
loknotify/applications.py,sha256=elYtWQSH1WoRRnzCCDyAu4lVqBqB0G38YYUvDnEQG_A,1137
|
|
5
|
+
loknotify/apps.py,sha256=QM0Xv_bQW68tmMFTdaFzqnqG3iq09QZm_8-oDr7WEAU,555
|
|
6
|
+
loknotify/checks.py,sha256=aNYbWmVue79ThUAevYV-s31rGkbZMJ5ozaa7jGpv6Ew,7418
|
|
7
|
+
loknotify/conf.py,sha256=g3qJTq0jwU_uYjRpUNaBeGPK9qGqf0gMtc2A5aebPkg,3271
|
|
8
|
+
loknotify/crypto.py,sha256=GFceZ3wkWiTh38L6br2N2uXS6o8fPgCNddpJmLfN12Q,2278
|
|
9
|
+
loknotify/engine.py,sha256=focpwlAuNns1JuVDT3V215N6xbNnr80q3m2kB_sumLw,11517
|
|
10
|
+
loknotify/events.py,sha256=dDrauEjpDVBB3xPymbQPbMweMr5p_8zfhCcbhhmDCO8,15545
|
|
11
|
+
loknotify/exceptions.py,sha256=B0wrGGyOYS4Arolr5SMgFiLLZeVCtVuG8jAGqMMzkhw,1431
|
|
12
|
+
loknotify/filters.py,sha256=r5hXIi-yEHhDQeNHvrcDDq_RB_qtao2zmGa7L6clcto,3522
|
|
13
|
+
loknotify/maintenance.py,sha256=Vo9H1vdsN1yUYbcSyofL-6oSiOqoPHyTKqWsuie0XrY,2285
|
|
14
|
+
loknotify/models.py,sha256=sfcK9JGGYXZskBaGdLBxE_EOp_wT3wKYbCRHBzcIMuo,9876
|
|
15
|
+
loknotify/permissions.py,sha256=stQEZjyy4s1HfWmsTLIWNoEaIDdxcyuFT604JN85o7g,7756
|
|
16
|
+
loknotify/policy.py,sha256=4ZkFvhDaarObsG23I4PSCY91b4O8lnphFmoAUzEQbWg,5802
|
|
17
|
+
loknotify/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
+
loknotify/schedule.py,sha256=iZpfBD7iRL5hGcFFxh_f6PsOwGlz0Qqri-0nINdPy5I,6020
|
|
19
|
+
loknotify/sender.py,sha256=rJKKlaI3Dff93zY-LcaSgGtQUJOSWvupym1JsEzpBxg,5275
|
|
20
|
+
loknotify/services.py,sha256=tJ9jyJhafKyu5k-A1Tto3WyJRGXiHY2F0i6RVmOwTHQ,32276
|
|
21
|
+
loknotify/signals.py,sha256=r6pdaODIcU_ikVzgftI_ZLPsHfpmtknxD-8SziMTYWw,436
|
|
22
|
+
loknotify/testing.py,sha256=MeFV0Q_zVWQ3LpkD6gEhNtZ2kXEaDvUOD0gY_hdCeEw,5439
|
|
23
|
+
loknotify/types.py,sha256=xdNZpERltuRfn5XHTbfz2tSOORC2-rhlNLIc6ya1DLE,7832
|
|
24
|
+
loknotify/urls.py,sha256=mSUB4iUEY6Uxn4pPZ2ASCdr2SlfkxSnzlk-0ovEVbHI,1981
|
|
25
|
+
loknotify/views.py,sha256=MNxtgU-4BSr05nqRgzfmBzK0uAjRL7WA4kXnZFHPhvw,15080
|
|
26
|
+
loknotify/config/__init__.py,sha256=TYyUvkAmEFH9XWxaXUB4n5-glaWhuWN2QIIDeZ-hzPg,4463
|
|
27
|
+
loknotify/config/resolver.py,sha256=-19J9rc71entimSzILW2ARXBGY-JctzWsfEIUDYq90w,13076
|
|
28
|
+
loknotify/config/runtime.py,sha256=JaRO8hHrFmi2Y8yZ9ZFH88CMHK3Eag_m2G1idLff9G0,7359
|
|
29
|
+
loknotify/config/schema.py,sha256=fT1vuP1TDrtG_8apE5Tvy-AMtY7BBHFT8IPgqf8sYyM,10223
|
|
30
|
+
loknotify/dispatch/__init__.py,sha256=xJZ0Qsydk0gjuYnueCldz5rXIK_LMmn50N3cI_N9ReU,1625
|
|
31
|
+
loknotify/dispatch/celery.py,sha256=pg4wOUoZTI0EkFpG1E1RWuyvg-eRhBAaui0exQQNbTY,779
|
|
32
|
+
loknotify/dispatch/celery_tasks.py,sha256=4WZ8RPlVysGBluqzfr_Yatg_LrUrbG5js5qWCP6NSlk,347
|
|
33
|
+
loknotify/dispatch/sync.py,sha256=sWp0UY9HnPtezzZfaOGUWL1QzA96Dxqs5GU07GGAQs0,309
|
|
34
|
+
loknotify/dispatch/threadpool.py,sha256=mqEKvthS6BGClz0WWRdGHphOibdeelJumnlOy5QpbS8,1506
|
|
35
|
+
loknotify/formatting/__init__.py,sha256=8p62w26HxWHunynzvengyMTcfA5hcC_v0cZZdpPUIgQ,234
|
|
36
|
+
loknotify/formatting/pipeline.py,sha256=nNIgtTcKOTrqK2je4RBjA__2zlCnIu0yIMzXIjEo6bk,6115
|
|
37
|
+
loknotify/formatting/renderer.py,sha256=5qO5INQGUnwbDj8stJu_578klPrELKWaJjTF4M_lIic,6911
|
|
38
|
+
loknotify/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
|
+
loknotify/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
+
loknotify/management/commands/loknotify_config.py,sha256=Xx6VrUZPK_2PHLqsgJzCaGxchg4DdBZ9u8EE3mPhFnY,2307
|
|
41
|
+
loknotify/management/commands/loknotify_emit.py,sha256=sNzEm7SEXTmRWHlOUyemFWAfBip2CeQBkTjUOWReEzw,1276
|
|
42
|
+
loknotify/management/commands/loknotify_prune.py,sha256=9SFvThq4DwcV4RyTss2Fp_NMesUGok9WSjTKCxpdWaE,567
|
|
43
|
+
loknotify/management/commands/loknotify_retry_pending.py,sha256=gztDviJlmosv6RRhxqqA8e_EP8aAin79e4G5oc--XLc,530
|
|
44
|
+
loknotify/management/commands/loknotify_test_channel.py,sha256=0i4rPctxuTYldMZmytod9BPYeUH_vE0em13080qhq_E,1712
|
|
45
|
+
loknotify/migrations/0001_initial.py,sha256=2t-DCvcwoi2RAvFpAUFI8Eap8UceZ-NpEfK6bGQR-5o,13456
|
|
46
|
+
loknotify/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
47
|
+
loknotify/providers/__init__.py,sha256=n-OUPX_LMkEFJEq6qbi45xwl9dYKeW3mKmeTK2RfWJY,6974
|
|
48
|
+
loknotify/providers/base.py,sha256=0A_FI9CiVUvr9M0FkpZU_gj13x3TpmPsCLh6hIll4z4,10480
|
|
49
|
+
loknotify/providers/console.py,sha256=hsEcLoLuEoFePccP1TTcxtbvzJJM6J6OYlARzE2mAcA,2595
|
|
50
|
+
loknotify/providers/discord.py,sha256=2yTdb7_XKVS0HyYu212oAILeg-rS-CqAkIGDmNumj9s,18911
|
|
51
|
+
loknotify/providers/http.py,sha256=DLR-UerWwP7ZMSb7JkAfkT3CcVtgdzJasiGQU8HO0hk,3997
|
|
52
|
+
loknotify/providers/mailgun.py,sha256=YvkUIdqFcoSXZW8TKWgtRullMh9sIowVQZUyPzAYr_M,17226
|
|
53
|
+
loknotify/templates/admin/loknotify/choose_provider.html,sha256=k4WOpUjfpn8GTSElZpSiJmRj3aYlhcRyG5OiegVoMqU,748
|
|
54
|
+
loknotify/templates/admin/loknotify/event_reference.html,sha256=WCsh-RAQdRi49OXQK2OWtPbNZqfgNxILxCepqsElH44,990
|
|
55
|
+
loknotify/templates/admin/loknotify/preview.html,sha256=rPQDQ8CQCx1zQMcl9ZP6XqFudVkSUhufh4a4xLCVSOs,804
|
|
56
|
+
loknotify/templates/admin/loknotify/rule_change_form.html,sha256=pt97lpQyNDM8mJiUMBUm2cVEW9V11ffJAQAToqm4q04,283
|
|
57
|
+
loknotify/templates/loknotify/preview/discord_embed.html,sha256=etnBkN-Ro_pm-P402phMUoW_ndpg5Ge0KQV3FhVQMg4,1544
|
|
58
|
+
loknotify/templates/loknotify/preview/email.html,sha256=bnI7Or8lH-9RPcy2FJBYqQFaxBlPlgvrRvNQsLl2z7E,1110
|
|
59
|
+
loknotify/templates/loknotify/preview/json.html,sha256=dLwQACdIFQvzj4oqKLvJXHfBCqS1yPiIykr3jXLu39c,92
|
|
60
|
+
loknotify/templates/loknotify/preview/text.html,sha256=WTQ21cN1f6cQV03Jr6loyjARP41a91YK7g-5MJscJBE,95
|
|
61
|
+
django_loknotify-0.1.0.dist-info/METADATA,sha256=1SI35qBcZU-ADwOFkyaoztpuDKtUurH-oHj4vq4p7JE,4955
|
|
62
|
+
django_loknotify-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
63
|
+
django_loknotify-0.1.0.dist-info/top_level.txt,sha256=YEw1LeTTGy2_zCgEhmjcARX2s5fr7_aR2YczyORHnSE,10
|
|
64
|
+
django_loknotify-0.1.0.dist-info/RECORD,,
|