# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['django_generic_tasks', 'django_generic_tasks.migrations']

package_data = \
{'': ['*']}

install_requires = \
['CacheControl>=0.12.11,<0.13.0',
 'Django>=4.0.4,<5.0.0',
 'django-ninja>=0.17.0,<0.18.0',
 'google-auth>=2.6.6,<3.0.0',
 'google-cloud-tasks>=2.8.1,<3.0.0',
 'pydantic>=1.9.0,<2.0.0',
 'requests>=2.27.1,<3.0.0']

setup_kwargs = {
    'name': 'django-generic-tasks',
    'version': '0.5.0',
    'description': 'Active Job for Django',
    'long_description': 'django-generic-tasks\n====================\n\nActive Job for Django\n\nExample usage\n-------------\n\nDefine tasks in a ``tasks.py`` module within a Django app:\n\n`my_app/tasks.py <django_generic_tasks_example/my_app/tasks.py>`_\n\n::\n\n    from django.core.mail import send_mail\n    from pydantic import BaseModel\n\n    import django_generic_tasks as tasks\n\n\n    # define task params as a Pydantic BaseModel\n    class EmailNotificationParams(BaseModel):\n        subject: str\n        content: str\n        recipients: list[str]\n\n\n    # subclass Task and specify params type as a generic type argument and implement the run method\n    class EmailNotificationTask(tasks.Task[EmailNotificationParams]):\n        def run(self):\n            send_mail(\n                subject=self.params.subject,\n                message=self.params.content,\n                from_email=None,\n                recipient_list=self.params.recipients,\n            )\n\n\n    if __name__ == "__main__":\n        params = EmailNotificationParams(\n            subject="Hello",\n            content="Have a nice day",\n            recipients=["alice@example.com", "bob@example.com"],\n        )\n        task = EmailNotificationTask(params)\n\n        # run a task synchronously\n        task.run()\n\n        # run a task asynchronously using settings.TASKS_BACKEND\n        task.start()\n\nRegistering tasks\n-----------------\n\nSimilar to `signals <https://docs.djangoproject.com/en/4.0/topics/signals/#connecting-receiver-functions-1>`_, tasks have\nto be implicitly registered by ensuring they are imported during application startup. This can be done in the ``ready``\nmethod in an application\'s ``AppConfig``.\n\n`my_app/apps.py <django_generic_tasks_example/my_app/apps.py>`_\n\n::\n\n    from django.apps import AppConfig\n\n\n    class MyAppConfig(AppConfig):\n        default_auto_field = "django.db.models.BigAutoField"\n        name = "my_app"\n\n        def ready(self):\n            from . import tasks  # noqa: F401\n\nHTTP endpoints\n--------------\n\n`urls.py <django_generic_tasks_example/django_generic_tasks_example/urls.py>`_\n\n::\n\n    from django.contrib import admin\n    from django.urls import include, path\n\n    urlpatterns = [\n        path("admin/", admin.site.urls),\n        path("tasks/", include("django_generic_tasks.urls")),\n    ]\n\n``django-generic-tasks`` uses `django-ninja <https://django-ninja.rest-framework.com/>`_ to automatically expose API endpoints for running tasks. Each defined task\ngets its own API\nendpoint and uses the specified Pydantic ``BaseModel`` for parameter verification.\n\n.. image:: https://user-images.githubusercontent.com/11734309/165979039-df4d2bfe-4c38-4798-af2e-fd0792303608.png\n  :alt: autogenerated OpenAPI docs\n\nSupported backends\n------------------\n\nThreadingBackend\n~~~~~~~~~~~~~~~~\n\nRuns tasks in a new ``threading.Thread``.\n\nCloudTasksBackend\n~~~~~~~~~~~~~~~~~\n\nRuns tasks using `Cloud Tasks <https://cloud.google.com/tasks>`_ `HTTP Target tasks <https://cloud.google.com/tasks/docs/creating-http-target-tasks>`_.\n\nConfiguration\n-------------\n\n``TASKS_API_AUTHENTICATION``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nSpecifies the Python path to a function or class whose instances are callable to use to authenticate incoming task API calls. The function or callable class should accept a single parameter ``request`` representing the incoming request.\n\nType: ``Optional[str]``\n\nDefault: ``django_generic_tasks.security.BasicAuth``\n\nExamples:\n\n``my_app/authentication.py``\n\n::\n\n    # function\n    def authenticate(request):\n        """Only allow requests from localhost"""\n        return request.META["REMOTE_ADDR"] == "127.0.0.1"\n\n    # callable class instance\n    class Authenticator:\n        def __call__(self, request):\n            """Only allow requests from localhost"""\n            return request.META["REMOTE_ADDR"] == "127.0.0.1"\n\n``my_app/settings.py``\n\n::\n\n    TASKS_API_AUTHENTICATION = "my_app.authentication.authenticate"\n    # or\n    TASKS_API_AUTHENTICATION = "my_app.authentication.Authenticator"\n\nBuilt-in authentication methods:\n\n* ``django_generic_tasks.security.GoogleOIDCAuth`` - Enforces that incoming requests contain a Google-issued OIDC token in the authorization header. This can be automatically added to requests from Cloud Tasks and Cloud Scheduler.\n* ``django_generic_tasks.security.BasicAuth`` - Authenticates basic auth credentials using the Django authentication system\n* ``django_generic_tasks.security.NoAuth`` - No authentication, useful for development.\n\n``TASKS_BACKEND``\n~~~~~~~~~~~~~~~~~\n\nThe default backend to use to run tasks asynchronously.\n\nType: any class which implements the ``django_generic_tasks.backends.Backend`` protocol\n',
    'author': 'Jiayu Yi',
    'author_email': 'yijiayu@gmail.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/yi-jiayu/django-generic-tasks',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.9,<4.0',
}


setup(**setup_kwargs)
