Repository: celery/celery
Pull request: Update deprecated task module removal in 5.0 documentation
## Documentation update for removed functionality

Add extra information in documentation and fix outdated documentation concerning the removal of celery.task
Fixes #6558 

Problem statement:
no module named celery.task
from celery import shared_task
from .models import Test, Prices

from celery.decorators import periodic_task
from celery.task.schedules import crontab
import requests 
@shared_task
def create_price_items(name):
    Test.objects.create(name=name)
    

@periodic_task(run_every=(crontab(minute='*/1')))
def run_create_items():
    create_price_items.delay(name='new2020')
-------error----------
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\acer\Desktop\django\open source\dj-blog\src\dj-bitcoin-tracker-api\prices\tasks.py", line 5, in <module>
    **from celery.task.schedules import crontab
ModuleNotFoundError: No module named 'celery.task'**

Hints from issue discussion:
For anyone wondering: it seems the module was removed in 5.0.0rc2 [in this commit](https://github.com/celery/celery/commit/757101358222dde4a72a2d1ce1edb5411591ab96)  and it has been advised to use `celery.shared_task` [in the docs since 4.0.0](https://docs.celeryproject.org/en/4.0/userguide/tasks.html#basics). I couldn't find any deprecation notes in the changelogs for [version 4](https://docs.celeryproject.org/en/4.0/changelog.html) or [version 5](https://docs.celeryproject.org/en/v5.0.0/changelog.html).

From the docs: 
> #### How do I import the task decorator? And what’s “app”?
> 
> The task decorator is available on your Celery application instance, if you don’t know what this is then please read First Steps with Celery.
> 
> If you’re using Django (see First steps with Django), or you’re the author of a library then you probably want to use the shared_task() decorator:
> 
> ```python
> from celery import shared_task
> 
> @shared_task
> def add(x, y):
>     return x + y
> ```

Commit message: Update whatsnew-5.1.rst

Patch to review:
diff --git a/docs/history/whatsnew-5.0.rst b/docs/history/whatsnew-5.0.rst
index d2e2df90e62..4667eb43216 100644
--- a/docs/history/whatsnew-5.0.rst
+++ b/docs/history/whatsnew-5.0.rst
@@ -262,6 +262,9 @@ you should import `kombu.utils.encoding` instead.
 If you were using the `celery.task` module before, you should import directly
 from the `celery` module instead.
 
+If you were using the `celery.task` decorator you should use 
+`celery.shared_task` instead.
+
 .. _new_command_line_interface:
 
 New Command Line Interface
diff --git a/docs/internals/deprecation.rst b/docs/internals/deprecation.rst
index 222dd6644d9..23d03ad36f7 100644
--- a/docs/internals/deprecation.rst
+++ b/docs/internals/deprecation.rst
@@ -34,7 +34,7 @@ Compat Task Modules
 
         from celery import task
 
-- Module ``celery.task`` *may* be removed (not decided)
+- Module ``celery.task`` will be removed 
 
     This means you should change:
 
@@ -44,10 +44,21 @@ Compat Task Modules
 
     into:
 
+    .. code-block:: python
+
+        from celery import shared_task
+
+    -- and:
     .. code-block:: python
 
         from celery import task
 
+    into:
+
+    .. code-block:: python
+
+        from celery import shared_task
+
     -- and:
 
     .. code-block:: python
diff --git a/docs/whatsnew-5.1.rst b/docs/whatsnew-5.1.rst
index bdd35f0773c..2d03f00e3cf 100644
--- a/docs/whatsnew-5.1.rst
+++ b/docs/whatsnew-5.1.rst
@@ -290,6 +290,10 @@ you should import `kombu.utils.encoding` instead.
 If you were using the `celery.task` module before, you should import directly
 from the `celery` module instead.
 
+If you were using the `celery.task` decorator you should use 
+`celery.shared_task` instead.
+
+
 `azure-servicebus` 7.0.0 is now required
 ----------------------------------------
 


Code review comments:
diff_hunk: @@ -290,6 +290,10 @@ you should import `kombu.utils.encoding` instead.
 If you were using the `celery.task` module before, you should import directly
 from the `celery` module instead.
 
+If you were using the `celery.task` decorator you should use 
+`celery.shared_task` instead.
path: docs/whatsnew-5.1.rst
text: @user1:
or Task instead

@author:
Task is not a decorator, this does not seem to work?

@author:
I can add another line for completenes sake: 

```
If you were using `from celery.task import Task` you should use `from celery import Task` instead.
```

@user1:
you are right