You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure what's the best way to support app.task/shared_task returning instances of this base class but we can start by adding stubs for celery.contrib.django.task.DjangoTask (see API reference).
The text was updated successfully, but these errors were encountered:
A small mypy plugin can fill in the gap by tweaking the return type of the shared_task and Celery.task decorators. @sbdchd, would you be interested in hosting such plugin in this repo if I submit a pull request?
Edit:this is a minimalistic version of the plugin.
For non-mypy typecheckers, an explicit cast on the task would be needed to use the methods defined in DjangoTask. It does not affect the experience in any other way.
Celery 5.4 introduced some shortcuts for Django projects using a custom task class. This new DjangoTask base class adds the following methods:
https://docs.celeryq.dev/en/stable/django/first-steps-with-django.html#trigger-tasks-at-the-end-of-the-database-transaction
Not sure what's the best way to support
app.task
/shared_task
returning instances of this base class but we can start by adding stubs forcelery.contrib.django.task.DjangoTask
(see API reference).The text was updated successfully, but these errors were encountered: