django-qstash 0.0.6__tar.gz → 0.0.7__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.
Potentially problematic release.
This version of django-qstash might be problematic. Click here for more details.
- {django_qstash-0.0.6 → django_qstash-0.0.7}/PKG-INFO +1 -1
- {django_qstash-0.0.6 → django_qstash-0.0.7}/pyproject.toml +1 -1
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/__init__.py +1 -1
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/management/commands/task_schedules.py +13 -9
- django_qstash-0.0.7/src/django_qstash/schedules/migrations/__init__.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash.egg-info/PKG-INFO +1 -1
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash.egg-info/SOURCES.txt +1 -0
- django_qstash-0.0.7/tests/test_settings.py +63 -0
- django_qstash-0.0.6/tests/test_settings.py +0 -29
- {django_qstash-0.0.6 → django_qstash-0.0.7}/README.md +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/setup.cfg +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/callbacks.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/client.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/discovery/__init__.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/discovery/fields.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/discovery/models.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/discovery/utils.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/discovery/validators.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/exceptions.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/handlers.py +0 -0
- {django_qstash-0.0.6/src/django_qstash/management/commands → django_qstash-0.0.7/src/django_qstash/management}/__init__.py +0 -0
- {django_qstash-0.0.6/src/django_qstash/results → django_qstash-0.0.7/src/django_qstash/management/commands}/__init__.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/management/commands/clear_stale_results.py +0 -0
- {django_qstash-0.0.6/src/django_qstash/results/migrations → django_qstash-0.0.7/src/django_qstash/results}/__init__.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/results/admin.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/results/apps.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/results/migrations/0001_initial.py +0 -0
- {django_qstash-0.0.6/src/django_qstash/schedules → django_qstash-0.0.7/src/django_qstash/results/migrations}/__init__.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/results/models.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/results/services.py +0 -0
- {django_qstash-0.0.6/src/django_qstash/schedules/migrations → django_qstash-0.0.7/src/django_qstash/schedules}/__init__.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/schedules/admin.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/schedules/apps.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/schedules/exceptions.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/schedules/formatters.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/schedules/forms.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/schedules/migrations/0001_initial.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/schedules/migrations/0002_taskschedule_updated_at.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/schedules/models.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/schedules/services.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/schedules/signals.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/schedules/validators.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/settings.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/tasks.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/utils.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/views.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash.egg-info/dependency_links.txt +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash.egg-info/requires.txt +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash.egg-info/top_level.txt +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/tests/test_callbacks.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/tests/test_exceptions.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/tests/test_handlers.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/tests/test_results_models.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/tests/test_tasks.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/tests/test_utils.py +0 -0
- {django_qstash-0.0.6 → django_qstash-0.0.7}/tests/test_views.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: django-qstash
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Summary: A drop-in replacement for Celery's shared_task with Upstash QStash.
|
|
5
5
|
Author-email: Justin Mitchel <justin@codingforentrepreneurs.com>
|
|
6
6
|
Project-URL: Changelog, https://github.com/jmitchel3/django-qstash
|
{django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/management/commands/task_schedules.py
RENAMED
|
@@ -7,7 +7,8 @@ from django.apps import apps
|
|
|
7
7
|
from django.core.management.base import BaseCommand
|
|
8
8
|
from django.db import models
|
|
9
9
|
|
|
10
|
-
from django_qstash.
|
|
10
|
+
from django_qstash.callbacks import get_callback_url
|
|
11
|
+
from django_qstash.client import qstash_client
|
|
11
12
|
|
|
12
13
|
logger = logging.getLogger(__name__)
|
|
13
14
|
|
|
@@ -28,6 +29,11 @@ class Command(BaseCommand):
|
|
|
28
29
|
action="store_true",
|
|
29
30
|
help="Sync schedules from QStash to local database",
|
|
30
31
|
)
|
|
32
|
+
parser.add_argument(
|
|
33
|
+
"--no-input",
|
|
34
|
+
action="store_true",
|
|
35
|
+
help="Do not ask for confirmation",
|
|
36
|
+
)
|
|
31
37
|
|
|
32
38
|
def get_task_schedule_model(self) -> models.Model | None:
|
|
33
39
|
"""Get the TaskSchedule model if available."""
|
|
@@ -40,13 +46,10 @@ class Command(BaseCommand):
|
|
|
40
46
|
"Add `django_qstash.schedules` to INSTALLED_APPS and run migrations."
|
|
41
47
|
)
|
|
42
48
|
)
|
|
43
|
-
return None
|
|
44
49
|
|
|
45
50
|
def sync_schedules(self, schedules: list) -> None:
|
|
46
51
|
"""Sync remote schedules to local database."""
|
|
47
52
|
TaskSchedule = self.get_task_schedule_model()
|
|
48
|
-
if not TaskSchedule:
|
|
49
|
-
return
|
|
50
53
|
|
|
51
54
|
for schedule in schedules:
|
|
52
55
|
try:
|
|
@@ -72,6 +75,7 @@ class Command(BaseCommand):
|
|
|
72
75
|
logger.exception("Failed to sync schedule %s", schedule.schedule_id)
|
|
73
76
|
|
|
74
77
|
def handle(self, *args, **options) -> None:
|
|
78
|
+
auto_confirm = options.get("no_input")
|
|
75
79
|
if not (options.get("sync") or options.get("list")):
|
|
76
80
|
self.stdout.write(
|
|
77
81
|
self.style.ERROR("Please specify either --list or --sync option")
|
|
@@ -79,9 +83,8 @@ class Command(BaseCommand):
|
|
|
79
83
|
return
|
|
80
84
|
|
|
81
85
|
try:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
schedules = client.list_schedules()
|
|
86
|
+
destination = get_callback_url()
|
|
87
|
+
schedules = qstash_client.schedule.list()
|
|
85
88
|
|
|
86
89
|
self.stdout.write(
|
|
87
90
|
self.style.SUCCESS(
|
|
@@ -105,8 +108,9 @@ class Command(BaseCommand):
|
|
|
105
108
|
|
|
106
109
|
if options.get("sync"):
|
|
107
110
|
user_input = input("Do you want to sync remote schedules? (y/n): ")
|
|
108
|
-
if user_input.lower() == "y":
|
|
111
|
+
if user_input.lower() == "y" or auto_confirm:
|
|
109
112
|
self.sync_schedules(schedules)
|
|
110
|
-
|
|
113
|
+
else:
|
|
114
|
+
self.stdout.write(self.style.ERROR("Sync cancelled"))
|
|
111
115
|
except Exception as e:
|
|
112
116
|
self.stdout.write(self.style.ERROR(f"An error occurred: {str(e)}"))
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: django-qstash
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Summary: A drop-in replacement for Celery's shared_task with Upstash QStash.
|
|
5
5
|
Author-email: Justin Mitchel <justin@codingforentrepreneurs.com>
|
|
6
6
|
Project-URL: Changelog, https://github.com/jmitchel3/django-qstash
|
|
@@ -19,6 +19,7 @@ src/django_qstash/discovery/fields.py
|
|
|
19
19
|
src/django_qstash/discovery/models.py
|
|
20
20
|
src/django_qstash/discovery/utils.py
|
|
21
21
|
src/django_qstash/discovery/validators.py
|
|
22
|
+
src/django_qstash/management/__init__.py
|
|
22
23
|
src/django_qstash/management/commands/__init__.py
|
|
23
24
|
src/django_qstash/management/commands/clear_stale_results.py
|
|
24
25
|
src/django_qstash/management/commands/task_schedules.py
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import warnings
|
|
4
|
+
|
|
5
|
+
from django.test import TestCase
|
|
6
|
+
from django.test import override_settings
|
|
7
|
+
|
|
8
|
+
from django_qstash.settings import DJANGO_QSTASH_WEBHOOK_PATH
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SettingsTestCase(TestCase):
|
|
12
|
+
def test_default_webhook_path(self):
|
|
13
|
+
"""Test that default webhook path is set correctly"""
|
|
14
|
+
self.assertEqual(DJANGO_QSTASH_WEBHOOK_PATH, "/qstash/webhook/")
|
|
15
|
+
|
|
16
|
+
def test_warning_when_required_settings_missing(self):
|
|
17
|
+
"""Test that warning is raised when required settings are missing"""
|
|
18
|
+
with override_settings(QSTASH_TOKEN=None, DJANGO_QSTASH_DOMAIN=None):
|
|
19
|
+
with warnings.catch_warnings(record=True) as w:
|
|
20
|
+
warnings.simplefilter("always")
|
|
21
|
+
|
|
22
|
+
# Force reload of settings to trigger warning
|
|
23
|
+
from importlib import reload
|
|
24
|
+
|
|
25
|
+
import django_qstash.settings
|
|
26
|
+
|
|
27
|
+
reload(django_qstash.settings)
|
|
28
|
+
|
|
29
|
+
self.assertEqual(len(w), 1)
|
|
30
|
+
self.assertTrue(issubclass(w[0].category, RuntimeWarning))
|
|
31
|
+
self.assertIn(
|
|
32
|
+
"QSTASH_TOKEN and DJANGO_QSTASH_DOMAIN should be set",
|
|
33
|
+
str(w[0].message),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
@override_settings(QSTASH_TOKEN="test-token", DJANGO_QSTASH_DOMAIN="example.com")
|
|
37
|
+
def test_no_warning_when_settings_present(self):
|
|
38
|
+
"""Test that no warning is raised when required settings are present"""
|
|
39
|
+
with warnings.catch_warnings(record=True) as w:
|
|
40
|
+
warnings.simplefilter("always")
|
|
41
|
+
|
|
42
|
+
# Force reload of settings
|
|
43
|
+
from importlib import reload
|
|
44
|
+
|
|
45
|
+
import django_qstash.settings
|
|
46
|
+
|
|
47
|
+
reload(django_qstash.settings)
|
|
48
|
+
|
|
49
|
+
self.assertEqual(len(w), 0)
|
|
50
|
+
|
|
51
|
+
@override_settings(DJANGO_QSTASH_WEBHOOK_PATH="/custom/webhook/path/")
|
|
52
|
+
def test_custom_webhook_path(self):
|
|
53
|
+
"""Test that custom webhook path can be set"""
|
|
54
|
+
# Force reload of settings to get new webhook path
|
|
55
|
+
from importlib import reload
|
|
56
|
+
|
|
57
|
+
import django_qstash.settings
|
|
58
|
+
|
|
59
|
+
reload(django_qstash.settings)
|
|
60
|
+
|
|
61
|
+
self.assertEqual(
|
|
62
|
+
django_qstash.settings.DJANGO_QSTASH_WEBHOOK_PATH, "/custom/webhook/path/"
|
|
63
|
+
)
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# from django.conf import settings
|
|
2
|
-
# from django.test import TestCase
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
# class SettingsTestCase(TestCase):
|
|
8
|
-
# def test_required_settings_present(self):
|
|
9
|
-
# """Test that all required QStash settings are present"""
|
|
10
|
-
# self.assertTrue(hasattr(settings, "QSTASH_TOKEN"))
|
|
11
|
-
# self.assertTrue(hasattr(settings, "DJANGO_QSTASH_DOMAIN"))
|
|
12
|
-
# self.assertTrue(hasattr(settings, "QSTASH_CURRENT_SIGNING_KEY"))
|
|
13
|
-
# self.assertTrue(hasattr(settings, "QSTASH_NEXT_SIGNING_KEY"))
|
|
14
|
-
# def test_settings_values(self):
|
|
15
|
-
# """Test that settings have expected test values"""
|
|
16
|
-
# self.assertEqual(settings.QSTASH_TOKEN, "test-token")
|
|
17
|
-
# self.assertEqual(settings.DJANGO_QSTASH_DOMAIN, "example.com")
|
|
18
|
-
# self.assertEqual(settings.QSTASH_CURRENT_SIGNING_KEY, "current-key")
|
|
19
|
-
# self.assertEqual(settings.QSTASH_NEXT_SIGNING_KEY, "next-key")
|
|
20
|
-
|
|
21
|
-
# def test_required_apps_installed(self):
|
|
22
|
-
# """Test that required apps are in INSTALLED_APPS"""
|
|
23
|
-
# required_apps = [
|
|
24
|
-
# "django_qstash",
|
|
25
|
-
# "django_qstash.results",
|
|
26
|
-
# "django_qstash.schedules",
|
|
27
|
-
# ]
|
|
28
|
-
# for app in required_apps:
|
|
29
|
-
# self.assertIn(app, settings.INSTALLED_APPS)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/results/migrations/0001_initial.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_qstash-0.0.6 → django_qstash-0.0.7}/src/django_qstash/schedules/migrations/0001_initial.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|