goatnotify-rq 0.3.0__tar.gz
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.
- goatnotify_rq-0.3.0/LICENSE +21 -0
- goatnotify_rq-0.3.0/PKG-INFO +35 -0
- goatnotify_rq-0.3.0/README.md +10 -0
- goatnotify_rq-0.3.0/pyproject.toml +53 -0
- goatnotify_rq-0.3.0/pyproject.toml.orig +40 -0
- goatnotify_rq-0.3.0/src/goatnotify/rq/__init__.py +3 -0
- goatnotify_rq-0.3.0/src/goatnotify/rq/py.typed +0 -0
- goatnotify_rq-0.3.0/src/goatnotify/rq/queue.py +47 -0
- goatnotify_rq-0.3.0/src/goatnotify/rq/tasks.py +6 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Louis Midson LAJEANTY <midsonlajeanty@proton.me>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: goatnotify-rq
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: RQ queue for GoatNotify, with delivery receipts that make retries idempotent.
|
|
5
|
+
Keywords: notifications,email,rq,redis,queue,asyncio,typed
|
|
6
|
+
Author: Louis Midson LAJEANTY
|
|
7
|
+
Author-email: Louis Midson LAJEANTY <midsonlajeanty@proton.me>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Framework :: Django
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Typing :: Typed
|
|
16
|
+
Requires-Dist: goatnotify-core==0.3.0
|
|
17
|
+
Requires-Dist: goatnotify-django==0.3.0
|
|
18
|
+
Requires-Dist: redis>=5.0
|
|
19
|
+
Requires-Dist: rq>=2.0
|
|
20
|
+
Requires-Python: >=3.14
|
|
21
|
+
Project-URL: Homepage, https://github.com/goatlabshq/goatnotify
|
|
22
|
+
Project-URL: Documentation, https://goatlabshq.github.io/goatnotify/
|
|
23
|
+
Project-URL: Issues, https://github.com/goatlabshq/goatnotify/issues
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# goatnotify-rq
|
|
27
|
+
|
|
28
|
+
RQ queue for GoatNotify in Django projects. Delivery receipts make RQ's retries idempotent: a
|
|
29
|
+
message already sent is never sent again.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install goatnotify-rq
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Documentation: <https://goatlabshq.github.io/goatnotify/queues/#rq>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# goatnotify-rq
|
|
2
|
+
|
|
3
|
+
RQ queue for GoatNotify in Django projects. Delivery receipts make RQ's retries idempotent: a
|
|
4
|
+
message already sent is never sent again.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pip install goatnotify-rq
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Documentation: <https://goatlabshq.github.io/goatnotify/queues/#rq>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "goatnotify-rq"
|
|
3
|
+
version = "0.3.0"
|
|
4
|
+
description = "RQ queue for GoatNotify, with delivery receipts that make retries idempotent."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.14"
|
|
9
|
+
keywords = [
|
|
10
|
+
"notifications",
|
|
11
|
+
"email",
|
|
12
|
+
"rq",
|
|
13
|
+
"redis",
|
|
14
|
+
"queue",
|
|
15
|
+
"asyncio",
|
|
16
|
+
"typed",
|
|
17
|
+
]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 3 - Alpha",
|
|
20
|
+
"Framework :: Django",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.14",
|
|
24
|
+
"Typing :: Typed",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"goatnotify-core==0.3.0",
|
|
28
|
+
"goatnotify-django==0.3.0",
|
|
29
|
+
"redis>=5.0",
|
|
30
|
+
"rq>=2.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[[project.authors]]
|
|
34
|
+
name = "Louis Midson LAJEANTY"
|
|
35
|
+
email = "midsonlajeanty@proton.me"
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/goatlabshq/goatnotify"
|
|
39
|
+
Documentation = "https://goatlabshq.github.io/goatnotify/"
|
|
40
|
+
Issues = "https://github.com/goatlabshq/goatnotify/issues"
|
|
41
|
+
|
|
42
|
+
[build-system]
|
|
43
|
+
requires = ["uv_build>=0.12,<0.14"]
|
|
44
|
+
build-backend = "uv_build"
|
|
45
|
+
|
|
46
|
+
[tool.uv.build-backend]
|
|
47
|
+
module-name = "goatnotify.rq"
|
|
48
|
+
|
|
49
|
+
[tool.uv.sources.goatnotify-core]
|
|
50
|
+
workspace = true
|
|
51
|
+
|
|
52
|
+
[tool.uv.sources.goatnotify-django]
|
|
53
|
+
workspace = true
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "goatnotify-rq"
|
|
3
|
+
version = "0.3.0" # x-release-please-version
|
|
4
|
+
description = "RQ queue for GoatNotify, with delivery receipts that make retries idempotent."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [{ name = "Louis Midson LAJEANTY", email = "midsonlajeanty@proton.me" }]
|
|
9
|
+
requires-python = ">=3.14"
|
|
10
|
+
keywords = ["notifications", "email", "rq", "redis", "queue", "asyncio", "typed"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 3 - Alpha",
|
|
13
|
+
"Framework :: Django",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.14",
|
|
17
|
+
"Typing :: Typed",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"goatnotify-core==0.3.0", # x-release-please-version
|
|
21
|
+
"goatnotify-django==0.3.0", # x-release-please-version
|
|
22
|
+
"redis>=5.0",
|
|
23
|
+
"rq>=2.0",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/goatlabshq/goatnotify"
|
|
28
|
+
Documentation = "https://goatlabshq.github.io/goatnotify/"
|
|
29
|
+
Issues = "https://github.com/goatlabshq/goatnotify/issues"
|
|
30
|
+
|
|
31
|
+
[build-system]
|
|
32
|
+
requires = ["uv_build>=0.12,<0.14"]
|
|
33
|
+
build-backend = "uv_build"
|
|
34
|
+
|
|
35
|
+
[tool.uv.build-backend]
|
|
36
|
+
module-name = "goatnotify.rq"
|
|
37
|
+
|
|
38
|
+
[tool.uv.sources]
|
|
39
|
+
goatnotify-core = { workspace = true }
|
|
40
|
+
goatnotify-django = { workspace = true }
|
|
File without changes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
from typing import Final, Protocol, cast
|
|
3
|
+
from uuid import uuid4
|
|
4
|
+
|
|
5
|
+
from redis import Redis
|
|
6
|
+
|
|
7
|
+
from goatnotify.core.notification import Notifiable
|
|
8
|
+
from goatnotify.core.queue import NotificationJob
|
|
9
|
+
from goatnotify.django.serialization import dump_job
|
|
10
|
+
from rq import Queue, Retry
|
|
11
|
+
|
|
12
|
+
FUNCTION: Final = "goatnotify.rq.tasks.deliver_notification"
|
|
13
|
+
DEFAULT_QUEUE: Final = "default"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class _Queue(Protocol):
|
|
17
|
+
"""The typed subset of ``rq.Queue`` used here (RQ leaves some parameters unannotated)."""
|
|
18
|
+
|
|
19
|
+
def enqueue_call(
|
|
20
|
+
self,
|
|
21
|
+
func: str,
|
|
22
|
+
args: tuple[object, ...],
|
|
23
|
+
*,
|
|
24
|
+
job_id: str,
|
|
25
|
+
retry: Retry | None,
|
|
26
|
+
) -> object: ...
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class RQQueue:
|
|
30
|
+
def __init__(
|
|
31
|
+
self, connection: Redis, *, queue: str = DEFAULT_QUEUE, retry: Retry | None = None
|
|
32
|
+
) -> None:
|
|
33
|
+
self._connection = connection
|
|
34
|
+
self._queue = queue
|
|
35
|
+
self._retry = retry
|
|
36
|
+
|
|
37
|
+
async def enqueue[R: Notifiable](self, job: NotificationJob[R]) -> None:
|
|
38
|
+
notifiable, notification = dump_job(job, queue=type(self).__name__)
|
|
39
|
+
job_id = str(uuid4())
|
|
40
|
+
queue = cast("_Queue", Queue(self._queue, connection=self._connection))
|
|
41
|
+
await asyncio.to_thread(
|
|
42
|
+
queue.enqueue_call,
|
|
43
|
+
FUNCTION,
|
|
44
|
+
(notifiable, notification, job_id),
|
|
45
|
+
job_id=job_id,
|
|
46
|
+
retry=self._retry,
|
|
47
|
+
)
|