<h1 dir="auto">Checklist</h1>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> This has already been asked to the <a href="https://groups.google.com/forum/#!forum/celery-users" rel="nofollow">discussion group</a> first.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have read the relevant section in the<br>
<a href="http://docs.celeryproject.org/en/latest/contributing.html#other-bugs" rel="nofollow">contribution guide</a><br>
on reporting bugs.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/issues?q=is%3Aissue+label%3A%22Issue+Type%3A+Bug+Report%22+-label%3A%22Category%3A+Documentation%22">issues list</a><br>
for similar or identical bug reports.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22PR+Type%3A+Bugfix%22+-label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed fixes.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/commits/master">commit log</a><br>
to find out if the bug was already fixed in the master branch.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included all related issues and possible duplicate issues<br>
in this issue (If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Mandatory Debugging Information</h2>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included the output of <code class="notranslate">celery -A proj report</code> in the issue.<br>
(if you are not able to do this, then at least specify the Celery<br>
version affected).</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included the contents of <code class="notranslate">pip freeze</code> in the issue.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included all the versions of all the external dependencies required<br>
to reproduce this bug.</li>
</ul>
<h2 dir="auto">Optional Debugging Information</h2>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one Python version<br>
and/or implementation.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one message broker and/or<br>
result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one version of the message<br>
broker and/or result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one operating system.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one workers pool.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue with autoscaling, retries,<br>
ETA/Countdown &amp; rate limits disabled.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue after downgrading<br>
and/or upgrading Celery and its dependencies.</li>
</ul>
<h2 dir="auto">Related Issues and Possible Duplicates</h2>

<h4 dir="auto">Related Issues</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h2 dir="auto">Environment &amp; Settings</h2>

<p dir="auto"><strong>Celery version</strong>:</p>

<details>
<summary><b><code class="notranslate">celery report</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate"></code></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Steps to Reproduce</h1>
<h2 dir="auto">Required Dependencies</h2>

<ul dir="auto">
<li><strong>Minimal Python Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Celery Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Kombu Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Version</strong>: N/A or Unknown</li>
<li><strong>Minimal OS and/or Kernel Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Client Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Client Version</strong>: N/A or Unknown</li>
</ul>
<h3 dir="auto">Python Packages</h3>

<details>
<summary><b><code class="notranslate">pip freeze</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate"></code></pre></div>
<p dir="auto"></p>
</details>
<h3 dir="auto">Other Dependencies</h3>

<details>
<p dir="auto">
N/A
</p>
</details>
<h2 dir="auto">Minimally Reproducible Test Case</h2>

<details>
<p dir="auto">
</p><div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<h1 dir="auto">Actual Behavior</h1>
<h1 dir="auto">Checklist</h1>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/issues?utf8=%E2%9C%93&amp;q=is%3Aissue+label%3A%22Category%3A+Documentation%22+">issues list</a><br>
for similar or identical bug reports.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed fixes.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/commits/master">commit log</a><br>
to find out if the bug was already fixed in the master branch.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included all related issues and possible duplicate issues in this issue<br>
(If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Related Issues and Possible Duplicates</h2>
<h4 dir="auto">Related Issues</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h1 dir="auto">Description</h1>
<p dir="auto">As of <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/celery/celery/commit/3cf5072ee5f95744024f60e0f4a77eb2edb8959f/hovercard" href="https://github.com/celery/celery/commit/3cf5072ee5f95744024f60e0f4a77eb2edb8959f"><tt>3cf5072</tt></a>, <a href="https://docs.celeryproject.org/en/master/userguide/tasks.html#automatic-naming-and-relative-imports" rel="nofollow">Tasks § Automatic naming and relative imports</a> states:</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/celery/celery/blob/3cf5072ee5f95744024f60e0f4a77eb2edb8959f/docs/userguide/tasks.rst#L260-L266">celery/docs/userguide/tasks.rst</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 260 to 266
      in
      <a data-pjax="true" class="commit-tease-sha" href="/celery/celery/commit/3cf5072ee5f95744024f60e0f4a77eb2edb8959f">3cf5072</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L260" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="260"></td>
          <td id="LC260" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> Relative imports and automatic name generation don't go well together, </td>
        </tr>

        <tr class="border-0">
          <td id="L261" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="261"></td>
          <td id="LC261" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> so if you're using relative imports you should set the name explicitly. </td>
        </tr>

        <tr class="border-0">
          <td id="L262" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="262"></td>
          <td id="LC262" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">  </td>
        </tr>

        <tr class="border-0">
          <td id="L263" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="263"></td>
          <td id="LC263" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> For example if the client imports the module ``<span class="pl-c1">"myapp.tasks"</span>`` </td>
        </tr>

        <tr class="border-0">
          <td id="L264" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="264"></td>
          <td id="LC264" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> as ``<span class="pl-c1">".tasks"</span>``, and the worker imports the module as ``<span class="pl-c1">"myapp.tasks"</span>``, </td>
        </tr>

        <tr class="border-0">
          <td id="L265" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="265"></td>
          <td id="LC265" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> the generated names won't match and an <span class="pl-k">:exc:</span>`<span class="pl-s">~@NotRegistered</span>` error will </td>
        </tr>

        <tr class="border-0">
          <td id="L266" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="266"></td>
          <td id="LC266" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> be raised by the worker. </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">However, it goes on to say:</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/celery/celery/blob/3cf5072ee5f95744024f60e0f4a77eb2edb8959f/docs/userguide/tasks.rst#L309-L313">celery/docs/userguide/tasks.rst</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 309 to 313
      in
      <a data-pjax="true" class="commit-tease-sha" href="/celery/celery/commit/3cf5072ee5f95744024f60e0f4a77eb2edb8959f">3cf5072</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L309" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="309"></td>
          <td id="LC309" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1"></span>New-style relative imports are fine and can be used: </td>
        </tr>

        <tr class="border-0">
          <td id="L310" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="310"></td>
          <td id="LC310" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">  </td>
        </tr>

        <tr class="border-0">
          <td id="L311" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="311"></td>
          <td id="LC311" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> .. <span class="pl-c1">code-block</span>:: <span class="pl-en">python</span><span class="pl-s1"></span> </td>
        </tr>

        <tr class="border-0">
          <td id="L312" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="312"></td>
          <td id="LC312" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1"></span> </td>
        </tr>

        <tr class="border-0">
          <td id="L313" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="313"></td>
          <td id="LC313" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1">    <span class="pl-k">from</span> .module <span class="pl-k">import</span> foo  <span class="pl-c"><span class="pl-c">#</span> GOOD!</span></span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">Hence, the documentation is inconsistent in saying whether or not new-style relative imports lead to inconsistent automatic task name generation for tasks contained within the imported module.</p>
<h1 dir="auto">Suggestions</h1>
<ul dir="auto">
<li>
<p dir="auto"><strong>Celery 5.x</strong>: Celery 5.0 dropped support for Python 2 and only supports Python 3. Since Python 3 does not support old-style relative imports, the entire section can be dropped.</p>
</li>
<li>
<p dir="auto"><strong>Celery 4.x</strong>: Change the description to the following:</p>
<blockquote>
<p dir="auto">For example if the client inside the <code class="notranslate">"myapp"</code> module imports the module <code class="notranslate">"myapp.tasks"</code> as <code class="notranslate">"tasks"</code>, and the worker imports the module as <code class="notranslate">"myapp.tasks"</code>, the generated names won't match and an :exc:<code class="notranslate">~@NotRegistered</code> error will be raised by the worker.</p>
</blockquote>
</li>
</ul>