diff --git a/README.md b/README.md index e5d2f66..a3407e6 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ If omitted, the following configuration is used: ```python TASKS = { "default": { - "BACKEND": "django_core_tasks.backends.immediate.ImmediateBackend" + "BACKEND": "django_tasks.backends.immediate.ImmediateBackend" } } ``` @@ -44,7 +44,7 @@ A few backends are included by default: A task is created with the `task` decorator. ```python -from django_core_tasks import task +from django_tasks import task @task() diff --git a/django_core_tasks/__init__.py b/django_tasks/__init__.py similarity index 95% rename from django_core_tasks/__init__.py rename to django_tasks/__init__.py index 651da50..727980f 100644 --- a/django_core_tasks/__init__.py +++ b/django_tasks/__init__.py @@ -31,7 +31,7 @@ def configure_settings(self, settings: Optional[dict]) -> dict: # Can be replaced with `django.conf.global_settings` once vendored. return { "default": { - "BACKEND": "django_core_tasks.backends.immediate.ImmediateBackend" + "BACKEND": "django_tasks.backends.immediate.ImmediateBackend" } } diff --git a/django_core_tasks/apps.py b/django_tasks/apps.py similarity index 82% rename from django_core_tasks/apps.py rename to django_tasks/apps.py index 67e53b5..f5ab1ee 100644 --- a/django_core_tasks/apps.py +++ b/django_tasks/apps.py @@ -2,7 +2,7 @@ class TasksAppConfig(AppConfig): - name = "django_core_tasks" + name = "django_tasks" def ready(self) -> None: from . import signal_handlers # noqa diff --git a/django_core_tasks/backends/__init__.py b/django_tasks/backends/__init__.py similarity index 100% rename from django_core_tasks/backends/__init__.py rename to django_tasks/backends/__init__.py diff --git a/django_core_tasks/backends/base.py b/django_tasks/backends/base.py similarity index 94% rename from django_core_tasks/backends/base.py rename to django_tasks/backends/base.py index 26114a8..2830473 100644 --- a/django_core_tasks/backends/base.py +++ b/django_tasks/backends/base.py @@ -6,9 +6,9 @@ from django.utils import timezone from typing_extensions import ParamSpec -from django_core_tasks.exceptions import InvalidTaskError -from django_core_tasks.task import Task, TaskResult -from django_core_tasks.utils import is_global_function +from django_tasks.exceptions import InvalidTaskError +from django_tasks.task import Task, TaskResult +from django_tasks.utils import is_global_function T = TypeVar("T") P = ParamSpec("P") diff --git a/django_core_tasks/backends/dummy.py b/django_tasks/backends/dummy.py similarity index 91% rename from django_core_tasks/backends/dummy.py rename to django_tasks/backends/dummy.py index 5ad22f9..466c7ec 100644 --- a/django_core_tasks/backends/dummy.py +++ b/django_tasks/backends/dummy.py @@ -4,8 +4,8 @@ from typing_extensions import ParamSpec -from django_core_tasks.exceptions import ResultDoesNotExist -from django_core_tasks.task import ResultStatus, Task, TaskResult +from django_tasks.exceptions import ResultDoesNotExist +from django_tasks.task import ResultStatus, Task, TaskResult from .base import BaseTaskBackend diff --git a/django_core_tasks/backends/immediate.py b/django_tasks/backends/immediate.py similarity index 94% rename from django_core_tasks/backends/immediate.py rename to django_tasks/backends/immediate.py index b1e7528..2c445ee 100644 --- a/django_core_tasks/backends/immediate.py +++ b/django_tasks/backends/immediate.py @@ -5,7 +5,7 @@ from asgiref.sync import async_to_sync from typing_extensions import ParamSpec -from django_core_tasks.task import ResultStatus, Task, TaskResult +from django_tasks.task import ResultStatus, Task, TaskResult from .base import BaseTaskBackend diff --git a/django_core_tasks/exceptions.py b/django_tasks/exceptions.py similarity index 100% rename from django_core_tasks/exceptions.py rename to django_tasks/exceptions.py diff --git a/django_core_tasks/signal_handlers.py b/django_tasks/signal_handlers.py similarity index 88% rename from django_core_tasks/signal_handlers.py rename to django_tasks/signal_handlers.py index b58b5f4..bcaabc1 100644 --- a/django_core_tasks/signal_handlers.py +++ b/django_tasks/signal_handlers.py @@ -9,7 +9,7 @@ def clear_tasks_handlers(*, setting: str, **kwargs: dict) -> None: Reset the connection handler whenever the settings change """ if setting == "TASKS": - from django_core_tasks import close_task_backends, tasks + from django_tasks import close_task_backends, tasks close_task_backends() tasks._settings = tasks.settings = tasks.configure_settings(None) # type:ignore[attr-defined] diff --git a/django_core_tasks/task.py b/django_tasks/task.py similarity index 100% rename from django_core_tasks/task.py rename to django_tasks/task.py diff --git a/django_core_tasks/utils.py b/django_tasks/utils.py similarity index 100% rename from django_core_tasks/utils.py rename to django_tasks/utils.py diff --git a/justfile b/justfile index 2248796..9099eee 100644 --- a/justfile +++ b/justfile @@ -3,15 +3,15 @@ just --list test *ARGS: - coverage run --source=django_core_tasks manage.py test {{ ARGS }} + coverage run --source=django_tasks manage.py test {{ ARGS }} coverage report coverage html format: - ruff check django_core_tasks tests --fix - ruff format django_core_tasks tests + ruff check django_tasks tests --fix + ruff format django_tasks tests lint: - ruff check django_core_tasks tests - ruff format django_core_tasks tests --check - mypy django_core_tasks tests + ruff check django_tasks tests + ruff format django_tasks tests --check + mypy django_tasks tests diff --git a/tests/settings.py b/tests/settings.py index b8fe0f2..a77cb33 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -9,7 +9,7 @@ ALLOWED_HOSTS = ["*"] INSTALLED_APPS = [ - "django_core_tasks", + "django_tasks", "tests", ] diff --git a/tests/tasks.py b/tests/tasks.py index d98a1e3..1ce61bf 100644 --- a/tests/tasks.py +++ b/tests/tasks.py @@ -1,4 +1,4 @@ -from django_core_tasks import task +from django_tasks import task @task() diff --git a/tests/tests/is_global_function_fixture.py b/tests/tests/is_global_function_fixture.py index 267932c..d145628 100644 --- a/tests/tests/is_global_function_fixture.py +++ b/tests/tests/is_global_function_fixture.py @@ -3,7 +3,7 @@ because it's covered by a decorator. """ -from django_core_tasks.utils import is_global_function +from django_tasks.utils import is_global_function @is_global_function diff --git a/tests/tests/test_dummy_backend.py b/tests/tests/test_dummy_backend.py index 1f6219c..90a4217 100644 --- a/tests/tests/test_dummy_backend.py +++ b/tests/tests/test_dummy_backend.py @@ -3,14 +3,14 @@ from django.test import SimpleTestCase, override_settings from django.urls import reverse -from django_core_tasks import ResultStatus, default_task_backend, tasks -from django_core_tasks.backends.dummy import DummyBackend -from django_core_tasks.exceptions import ResultDoesNotExist +from django_tasks import ResultStatus, default_task_backend, tasks +from django_tasks.backends.dummy import DummyBackend +from django_tasks.exceptions import ResultDoesNotExist from tests import tasks as test_tasks @override_settings( - TASKS={"default": {"BACKEND": "django_core_tasks.backends.dummy.DummyBackend"}} + TASKS={"default": {"BACKEND": "django_tasks.backends.dummy.DummyBackend"}} ) class DummyBackendTestCase(SimpleTestCase): def setUp(self) -> None: diff --git a/tests/tests/test_immediate_backend.py b/tests/tests/test_immediate_backend.py index 85b5f21..c3f58b2 100644 --- a/tests/tests/test_immediate_backend.py +++ b/tests/tests/test_immediate_backend.py @@ -4,16 +4,14 @@ from django.urls import reverse from django.utils import timezone -from django_core_tasks import ResultStatus, default_task_backend, tasks -from django_core_tasks.backends.immediate import ImmediateBackend -from django_core_tasks.exceptions import InvalidTaskError +from django_tasks import ResultStatus, default_task_backend, tasks +from django_tasks.backends.immediate import ImmediateBackend +from django_tasks.exceptions import InvalidTaskError from tests import tasks as test_tasks @override_settings( - TASKS={ - "default": {"BACKEND": "django_core_tasks.backends.immediate.ImmediateBackend"} - } + TASKS={"default": {"BACKEND": "django_tasks.backends.immediate.ImmediateBackend"}} ) class ImmediateBackendTestCase(SimpleTestCase): def test_using_correct_backend(self) -> None: diff --git a/tests/tests/test_tasks.py b/tests/tests/test_tasks.py index 0573b65..641a3b0 100644 --- a/tests/tests/test_tasks.py +++ b/tests/tests/test_tasks.py @@ -4,10 +4,10 @@ from django.test import SimpleTestCase, override_settings from django.utils import timezone -from django_core_tasks import ResultStatus, default_task_backend, task, tasks -from django_core_tasks.backends.dummy import DummyBackend -from django_core_tasks.backends.immediate import ImmediateBackend -from django_core_tasks.exceptions import ( +from django_tasks import ResultStatus, default_task_backend, task, tasks +from django_tasks.backends.dummy import DummyBackend +from django_tasks.backends.immediate import ImmediateBackend +from django_tasks.exceptions import ( InvalidTaskBackendError, InvalidTaskError, ResultDoesNotExist, @@ -17,10 +17,8 @@ @override_settings( TASKS={ - "default": {"BACKEND": "django_core_tasks.backends.dummy.DummyBackend"}, - "immediate": { - "BACKEND": "django_core_tasks.backends.immediate.ImmediateBackend" - }, + "default": {"BACKEND": "django_tasks.backends.dummy.DummyBackend"}, + "immediate": {"BACKEND": "django_tasks.backends.immediate.ImmediateBackend"}, "missing": {"BACKEND": "does.not.exist"}, } ) diff --git a/tests/tests/test_utils.py b/tests/tests/test_utils.py index 338030b..ca988c8 100644 --- a/tests/tests/test_utils.py +++ b/tests/tests/test_utils.py @@ -2,7 +2,7 @@ from django.test import SimpleTestCase -from django_core_tasks import utils +from django_tasks import utils from tests import tasks as test_tasks diff --git a/tests/views.py b/tests/views.py index 42be681..ccf880d 100644 --- a/tests/views.py +++ b/tests/views.py @@ -1,7 +1,7 @@ from django.http import Http404, HttpRequest, HttpResponse, JsonResponse -from django_core_tasks import default_task_backend -from django_core_tasks.exceptions import ResultDoesNotExist +from django_tasks import default_task_backend +from django_tasks.exceptions import ResultDoesNotExist from . import tasks