This document describes the current stable version of Celery (4.2). For development docs, go here.

Documenting Tasks with Sphinx

This document describes how auto-generate documentation for Tasks using Sphinx.


Sphinx documentation plugin used to document tasks.



Add the extension to your docs/ configuration module:

extensions = (...,

If you’d like to change the prefix for tasks in reference documentation then you can change the celery_task_prefix configuration value:

celery_task_prefix = '(task)'  # < default

With the extension installed autodoc will automatically find task decorated objects (e.g. when using the automodule directive) and generate the correct (as well as add a (task) prefix), and you can also refer to the tasks using :task:proj.tasks.add syntax.

Use .. autotask:: to alternatively manually document a task.

class celery.contrib.sphinx.TaskDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]

Sphinx task directive.


May return a prefix to put before the object name in the signature.

class celery.contrib.sphinx.TaskDocumenter(directive, name, indent=u'')[source]

Document task definitions.

classmethod can_document_member(member, membername, isattr, parent)[source]

Called to see if a member can be documented by this documenter.


Check if self.object is really defined in the module given by self.modname.


Generate reST for member documentation.

If all_members is True, do all members, else those given by self.options.members.


Format the argument signature of self.object.

Should return None if the object does not have a signature.

celery.contrib.sphinx.autodoc_skip_member_handler(app, what, name, obj, skip, options)[source]

Handler for autodoc-skip-member event.


Setup Sphinx extension.