Checklist
Mandatory Debugging Information
Optional Debugging Information
Related Issues and Possible Duplicates
Related Issues
Possible Duplicates
Environment & Settings
Celery version:
celery report Output:
software -> celery:5.5.3 (immunity) kombu:5.5.4 py:3.13.7
billiard:4.2.1 py-amqp:5.3.1
platform -> system:Linux arch:64bit, ELF
kernel version:6.5.0-45-generic imp:CPython
loader -> celery.loaders.default.Loader
settings -> transport:amqp results:disabled
deprecated_settings: None
Steps to Reproduce
Required Dependencies
- Minimal Python Version: All
- Minimal Celery Version: All
- Minimal Kombu Version: N/A
- Minimal Broker Version: N/A
- Minimal Result Backend Version: N/A
- Minimal OS and/or Kernel Version: N/A
- Minimal Broker Client Version: N/A
- Minimal Result Backend Client Version: N/A
Python Packages
pip freeze Output:
Other Dependencies
Details
Sphinx==8.2.3
Minimally Reproducible Test Case
- Document a Celery task with Sphinx
- Attempt to link to the task as described in the docs with:
Expected Behavior
An automatic link is generated
Actual Behavior
Sphinx build logs produce the error
Unknown interpreted text role "task". [docutils]
This is because celery.contrib.sphinx doesn't actually register the task role, only the directives to render a task.
In its setup it should also do
from sphinx.domains.python import PyXRefRole
def setup(app):
# ...
app.add_object_type(
directivename="task",
rolename="task",
objname="task",
indextemplate="pair: %s; task",
)
app.add_role_to_domain('py', 'task', PyXRefRole(fix_parens=True))
Note that fix_parens=True causes references to tasks to render in the same way functions do i.e. path.to.task()`). I've checked and this also works with the ~ notation so you can just render the task name.
As a stopgap, these can be added to your own setup() function in your docs config. I've done this in my project and it's then successfully able to generate links.
Note: I haven't made a discussion first as this is a simple bug, and I haven't done most of the debug steps since it's not related to the version or config of Celery. It's literally just that these lines are missing from the sphinx extension.
Checklist
mainbranch of Celery.contribution guide
on reporting bugs.
for similar or identical bug reports.
for existing proposed fixes.
to find out if the bug was already fixed in the main branch.
in this issue (If there are none, check this box anyway).
Mandatory Debugging Information
celery -A proj reportin the issue.(if you are not able to do this, then at least specify the Celery
version affected).
mainbranch of Celery.pip freezein the issue.to reproduce this bug.
Optional Debugging Information
and/or implementation.
result backend.
broker and/or result backend.
ETA/Countdown & rate limits disabled.
and/or upgrading Celery and its dependencies.
Related Issues and Possible Duplicates
Related Issues
Possible Duplicates
Environment & Settings
Celery version:
celery reportOutput:Steps to Reproduce
Required Dependencies
Python Packages
pip freezeOutput:Other Dependencies
Details
Sphinx==8.2.3
Minimally Reproducible Test Case
Expected Behavior
An automatic link is generated
Actual Behavior
Sphinx build logs produce the error
This is because
celery.contrib.sphinxdoesn't actually register the task role, only the directives to render a task.In its setup it should also do
Note that
fix_parens=Truecauses references to tasks to render in the same way functions doi.e.path.to.task()`). I've checked and this also works with the ~ notation so you can just render the task name.As a stopgap, these can be added to your own
setup()function in your docs config. I've done this in my project and it's then successfully able to generate links.Note: I haven't made a discussion first as this is a simple bug, and I haven't done most of the debug steps since it's not related to the version or config of Celery. It's literally just that these lines are missing from the sphinx extension.