contributing.rst 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133
  1. .. _contributing:
  2. ==============
  3. Contributing
  4. ==============
  5. Welcome!
  6. This document is fairly extensive and you aren't really expected
  7. to study this in detail for small contributions;
  8. The most important rule is that contributing must be easy
  9. and that the community is friendly and not nitpicking on details,
  10. such as coding style.
  11. If you're reporting a bug you should read the Reporting bugs section
  12. below to ensure that your bug report contains enough information
  13. to successfully diagnose the issue, and if you're contributing code
  14. you should try to mimic the conventions you see surrounding the code
  15. you're working on, but in the end all patches will be cleaned up by
  16. the person merging the changes so don't worry too much.
  17. .. contents::
  18. :local:
  19. .. _community-code-of-conduct:
  20. Community Code of Conduct
  21. =========================
  22. The goal is to maintain a diverse community that's pleasant for everyone.
  23. That's why we would greatly appreciate it if everyone contributing to and
  24. interacting with the community also followed this Code of Conduct.
  25. The Code of Conduct covers our behavior as members of the community,
  26. in any forum, mailing list, wiki, website, Internet relay chat (IRC), public
  27. meeting or private correspondence.
  28. The Code of Conduct is heavily based on the `Ubuntu Code of Conduct`_, and
  29. the `Pylons Code of Conduct`_.
  30. .. _`Ubuntu Code of Conduct`: http://www.ubuntu.com/community/conduct
  31. .. _`Pylons Code of Conduct`: http://docs.pylonshq.com/community/conduct.html
  32. Be considerate
  33. --------------
  34. Your work will be used by other people, and you in turn will depend on the
  35. work of others. Any decision you take will affect users and colleagues, and
  36. we expect you to take those consequences into account when making decisions.
  37. Even if it's not obvious at the time, our contributions to Celery will impact
  38. the work of others. For example, changes to code, infrastructure, policy,
  39. documentation and translations during a release may negatively impact
  40. others work.
  41. Be respectful
  42. -------------
  43. The Celery community and its members treat one another with respect. Everyone
  44. can make a valuable contribution to Celery. We may not always agree, but
  45. disagreement is no excuse for poor behavior and poor manners. We might all
  46. experience some frustration now and then, but we cannot allow that frustration
  47. to turn into a personal attack. It's important to remember that a community
  48. where people feel uncomfortable or threatened isn't a productive one. We
  49. expect members of the Celery community to be respectful when dealing with
  50. other contributors as well as with people outside the Celery project and with
  51. users of Celery.
  52. Be collaborative
  53. ----------------
  54. Collaboration is central to Celery and to the larger free software community.
  55. We should always be open to collaboration. Your work should be done
  56. transparently and patches from Celery should be given back to the community
  57. when they're made, not just when the distribution releases. If you wish
  58. to work on new code for existing upstream projects, at least keep those
  59. projects informed of your ideas and progress. It many not be possible to
  60. get consensus from upstream, or even from your colleagues about the correct
  61. implementation for an idea, so don't feel obliged to have that agreement
  62. before you begin, but at least keep the outside world informed of your work,
  63. and publish your work in a way that allows outsiders to test, discuss, and
  64. contribute to your efforts.
  65. When you disagree, consult others
  66. ---------------------------------
  67. Disagreements, both political and technical, happen all the time and
  68. the Celery community is no exception. It's important that we resolve
  69. disagreements and differing views constructively and with the help of the
  70. community and community process. If you really want to go a different
  71. way, then we encourage you to make a derivative distribution or alternate
  72. set of packages that still build on the work we've done to utilize as common
  73. of a core as possible.
  74. When you're unsure, ask for help
  75. --------------------------------
  76. Nobody knows everything, and nobody is expected to be perfect. Asking
  77. questions avoids many problems down the road, and so questions are
  78. encouraged. Those who are asked questions should be responsive and helpful.
  79. However, when asking a question, care must be taken to do so in an appropriate
  80. forum.
  81. Step down considerately
  82. -----------------------
  83. Developers on every project come and go and Celery is no different. When you
  84. leave or disengage from the project, in whole or in part, we ask that you do
  85. so in a way that minimizes disruption to the project. This means you should
  86. tell people you're leaving and take the proper steps to ensure that others
  87. can pick up where you leave off.
  88. .. _reporting-bugs:
  89. Reporting Bugs
  90. ==============
  91. .. _vulnsec:
  92. Security
  93. --------
  94. You must never report security related issues, vulnerabilities or bugs
  95. including sensitive information to the bug tracker, or elsewhere in public.
  96. Instead sensitive bugs must be sent by email to ``security@celeryproject.org``.
  97. If you'd like to submit the information encrypted our PGP key is::
  98. -----BEGIN PGP PUBLIC KEY BLOCK-----
  99. Version: GnuPG v1.4.15 (Darwin)
  100. mQENBFJpWDkBCADFIc9/Fpgse4owLNvsTC7GYfnJL19XO0hnL99sPx+DPbfr+cSE
  101. 9wiU+Wp2TfUX7pCLEGrODiEP6ZCZbgtiPgId+JYvMxpP6GXbjiIlHRw1EQNH8RlX
  102. cVxy3rQfVv8PGGiJuyBBjxzvETHW25htVAZ5TI1+CkxmuyyEYqgZN2fNd0wEU19D
  103. +c10G1gSECbCQTCbacLSzdpngAt1Gkrc96r7wGHBBSvDaGDD2pFSkVuTLMbIRrVp
  104. lnKOPMsUijiip2EMr2DvfuXiUIUvaqInTPNWkDynLoh69ib5xC19CSVLONjkKBsr
  105. Pe+qAY29liBatatpXsydY7GIUzyBT3MzgMJlABEBAAG0MUNlbGVyeSBTZWN1cml0
  106. eSBUZWFtIDxzZWN1cml0eUBjZWxlcnlwcm9qZWN0Lm9yZz6JATgEEwECACIFAlJp
  107. WDkCGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEOArFOUDCicIw1IH/26f
  108. CViDC7/P13jr+srRdjAsWvQztia9HmTlY8cUnbmkR9w6b6j3F2ayw8VhkyFWgYEJ
  109. wtPBv8mHKADiVSFARS+0yGsfCkia5wDSQuIv6XqRlIrXUyqJbmF4NUFTyCZYoh+C
  110. ZiQpN9xGhFPr5QDlMx2izWg1rvWlG1jY2Es1v/xED3AeCOB1eUGvRe/uJHKjGv7J
  111. rj0pFcptZX+WDF22AN235WYwgJM6TrNfSu8sv8vNAQOVnsKcgsqhuwomSGsOfMQj
  112. LFzIn95MKBBU1G5wOs7JtwiV9jefGqJGBO2FAvOVbvPdK/saSnB+7K36dQcIHqms
  113. 5hU4Xj0RIJiod5idlRC5AQ0EUmlYOQEIAJs8OwHMkrdcvy9kk2HBVbdqhgAREMKy
  114. gmphDp7prRL9FqSY/dKpCbG0u82zyJypdb7QiaQ5pfPzPpQcd2dIcohkkh7G3E+e
  115. hS2L9AXHpwR26/PzMBXyr2iNnNc4vTksHvGVDxzFnRpka6vbI/hrrZmYNYh9EAiv
  116. uhE54b3/XhXwFgHjZXb9i8hgJ3nsO0pRwvUAM1bRGMbvf8e9F+kqgV0yWYNnh6QL
  117. 4Vpl1+epqp2RKPHyNQftbQyrAHXT9kQF9pPlx013MKYaFTADscuAp4T3dy7xmiwS
  118. crqMbZLzfrxfFOsNxTUGE5vmJCcm+mybAtRo4aV6ACohAO9NevMx8pUAEQEAAYkB
  119. HwQYAQIACQUCUmlYOQIbDAAKCRDgKxTlAwonCNFbB/9esir/f7TufE+isNqErzR/
  120. aZKZo2WzZR9c75kbqo6J6DYuUHe6xI0OZ2qZ60iABDEZAiNXGulysFLCiPdatQ8x
  121. 8zt3DF9BMkEck54ZvAjpNSern6zfZb1jPYWZq3TKxlTs/GuCgBAuV4i5vDTZ7xK/
  122. aF+OFY5zN7ciZHkqLgMiTZ+RhqRcK6FhVBP/Y7d9NlBOcDBTxxE1ZO1ute6n7guJ
  123. ciw4hfoRk8qNN19szZuq3UU64zpkM2sBsIFM9tGF2FADRxiOaOWZHmIyVZriPFqW
  124. RUwjSjs7jBVNq0Vy4fCu/5+e+XLOUBOoqtM5W7ELt0t1w9tXebtPEetV86in8fU2
  125. =0chn
  126. -----END PGP PUBLIC KEY BLOCK-----
  127. Other bugs
  128. ----------
  129. Bugs can always be described to the :ref:`mailing-list`, but the best
  130. way to report an issue and to ensure a timely response is to use the
  131. issue tracker.
  132. 1) **Create a GitHub account**.
  133. You need to `create a GitHub account`_ to be able to create new issues
  134. and participate in the discussion.
  135. .. _`create a GitHub account`: https://github.com/signup/free
  136. 2) **Determine if your bug is really a bug**.
  137. You shouldn't file a bug if you're requesting support. For that you can use
  138. the :ref:`mailing-list`, or :ref:`irc-channel`.
  139. 3) **Make sure your bug hasn't already been reported**.
  140. Search through the appropriate Issue tracker. If a bug like yours was found,
  141. check if you have new information that could be reported to help
  142. the developers fix the bug.
  143. 4) **Check if you're using the latest version**.
  144. A bug could be fixed by some other improvements and fixes - it might not have an
  145. existing report in the bug tracker. Make sure you're using the latest releases of
  146. celery, billiard, kombu, amqp, and vine.
  147. 5) **Collect information about the bug**.
  148. To have the best chance of having a bug fixed, we need to be able to easily
  149. reproduce the conditions that caused it. Most of the time this information
  150. will be from a Python traceback message, though some bugs might be in design,
  151. spelling or other errors on the website/docs/code.
  152. A) If the error is from a Python traceback, include it in the bug report.
  153. B) We also need to know what platform you're running (Windows, macOS, Linux,
  154. etc.), the version of your Python interpreter, and the version of Celery,
  155. and related packages that you were running when the bug occurred.
  156. C) If you're reporting a race condition or a deadlock, tracebacks can be
  157. hard to get or might not be that useful. Try to inspect the process to
  158. get more diagnostic data. Some ideas:
  159. * Enable Celery's :ref:`breakpoint signal <breakpoint_signal>` and use it
  160. to inspect the process's state. This will allow you to open a
  161. :mod:`pdb` session.
  162. * Collect tracing data using `strace`_(Linux),
  163. :command:`dtruss` (macOS), and :command:`ktrace` (BSD),
  164. `ltrace`_, and `lsof`_.
  165. D) Include the output from the :command:`celery report` command:
  166. .. code-block:: console
  167. $ celery -A proj report
  168. This will also include your configuration settings and it try to
  169. remove values for keys known to be sensitive, but make sure you also
  170. verify the information before submitting so that it doesn't contain
  171. confidential information like API tokens and authentication
  172. credentials.
  173. 6) **Submit the bug**.
  174. By default `GitHub`_ will email you to let you know when new comments have
  175. been made on your bug. In the event you've turned this feature off, you
  176. should check back on occasion to ensure you don't miss any questions a
  177. developer trying to fix the bug might ask.
  178. .. _`GitHub`: https://github.com
  179. .. _`strace`: https://en.wikipedia.org/wiki/Strace
  180. .. _`ltrace`: https://en.wikipedia.org/wiki/Ltrace
  181. .. _`lsof`: https://en.wikipedia.org/wiki/Lsof
  182. .. _issue-trackers:
  183. Issue Trackers
  184. --------------
  185. Bugs for a package in the Celery ecosystem should be reported to the relevant
  186. issue tracker.
  187. * :pypi:`celery`: https://github.com/celery/celery/issues/
  188. * :pypi:`kombu`: https://github.com/celery/kombu/issues
  189. * :pypi:`amqp`: https://github.com/celery/py-amqp/issues
  190. * :pypi:`vine`: https://github.com/celery/vine/issues
  191. * :pypi:`librabbitmq`: https://github.com/celery/librabbitmq/issues
  192. * :pypi:`django-celery`: https://github.com/celery/django-celery/issues
  193. If you're unsure of the origin of the bug you can ask the
  194. :ref:`mailing-list`, or just use the Celery issue tracker.
  195. Contributors guide to the code base
  196. ===================================
  197. There's a separate section for internal details,
  198. including details about the code base and a style guide.
  199. Read :ref:`internals-guide` for more!
  200. .. _versions:
  201. Versions
  202. ========
  203. Version numbers consists of a major version, minor version and a release number.
  204. Since version 2.1.0 we use the versioning semantics described by
  205. SemVer: http://semver.org.
  206. Stable releases are published at PyPI
  207. while development releases are only available in the GitHub git repository as tags.
  208. All version tags starts with “v”, so version 0.8.0 is the tag v0.8.0.
  209. .. _git-branches:
  210. Branches
  211. ========
  212. Current active version branches:
  213. * master (https://github.com/celery/celery/tree/master)
  214. * 3.1 (https://github.com/celery/celery/tree/3.1)
  215. * 3.0 (https://github.com/celery/celery/tree/3.0)
  216. You can see the state of any branch by looking at the Changelog:
  217. https://github.com/celery/celery/blob/master/Changelog
  218. If the branch is in active development the topmost version info should
  219. contain meta-data like:
  220. .. code-block:: restructuredtext
  221. 2.4.0
  222. ======
  223. :release-date: TBA
  224. :status: DEVELOPMENT
  225. :branch: master
  226. The ``status`` field can be one of:
  227. * ``PLANNING``
  228. The branch is currently experimental and in the planning stage.
  229. * ``DEVELOPMENT``
  230. The branch is in active development, but the test suite should
  231. be passing and the product should be working and possible for users to test.
  232. * ``FROZEN``
  233. The branch is frozen, and no more features will be accepted.
  234. When a branch is frozen the focus is on testing the version as much
  235. as possible before it is released.
  236. ``master`` branch
  237. -----------------
  238. The master branch is where development of the next version happens.
  239. Maintenance branches
  240. --------------------
  241. Maintenance branches are named after the version -- for example,
  242. the maintenance branch for the 2.2.x series is named ``2.2``.
  243. Previously these were named ``releaseXX-maint``.
  244. The versions we currently maintain is:
  245. * 3.1
  246. This is the current series.
  247. * 3.0
  248. This is the previous series, and the last version to support Python 2.5.
  249. Archived branches
  250. -----------------
  251. Archived branches are kept for preserving history only,
  252. and theoretically someone could provide patches for these if they depend
  253. on a series that's no longer officially supported.
  254. An archived version is named ``X.Y-archived``.
  255. Our currently archived branches are:
  256. * :github_branch:`2.5-archived`
  257. * :github_branch:`2.4-archived`
  258. * :github_branch:`2.3-archived`
  259. * :github_branch:`2.1-archived`
  260. * :github_branch:`2.0-archived`
  261. * :github_branch:`1.0-archived`
  262. Feature branches
  263. ----------------
  264. Major new features are worked on in dedicated branches.
  265. There's no strict naming requirement for these branches.
  266. Feature branches are removed once they've been merged into a release branch.
  267. Tags
  268. ====
  269. - Tags are used exclusively for tagging releases. A release tag is
  270. named with the format ``vX.Y.Z`` -- for example ``v2.3.1``.
  271. - Experimental releases contain an additional identifier ``vX.Y.Z-id`` --
  272. for example ``v3.0.0-rc1``.
  273. - Experimental tags may be removed after the official release.
  274. .. _contributing-changes:
  275. Working on Features & Patches
  276. =============================
  277. .. note::
  278. Contributing to Celery should be as simple as possible,
  279. so none of these steps should be considered mandatory.
  280. You can even send in patches by email if that's your preferred
  281. work method. We won't like you any less, any contribution you make
  282. is always appreciated!
  283. However following these steps may make maintainers life easier,
  284. and may mean that your changes will be accepted sooner.
  285. Forking and setting up the repository
  286. -------------------------------------
  287. First you need to fork the Celery repository, a good introduction to this
  288. is in the GitHub Guide: `Fork a Repo`_.
  289. After you have cloned the repository you should checkout your copy
  290. to a directory on your machine:
  291. .. code-block:: console
  292. $ git clone git@github.com:username/celery.git
  293. When the repository is cloned enter the directory to set up easy access
  294. to upstream changes:
  295. .. code-block:: console
  296. $ cd celery
  297. $ git remote add upstream git://github.com/celery/celery.git
  298. $ git fetch upstream
  299. If you need to pull in new changes from upstream you should
  300. always use the ``--rebase`` option to ``git pull``:
  301. .. code-block:: console
  302. git pull --rebase upstream master
  303. With this option you don't clutter the history with merging
  304. commit notes. See `Rebasing merge commits in git`_.
  305. If you want to learn more about rebasing see the `Rebase`_
  306. section in the GitHub guides.
  307. If you need to work on a different branch than ``master`` you can
  308. fetch and checkout a remote branch like this::
  309. git checkout --track -b 3.0-devel origin/3.0-devel
  310. .. _`Fork a Repo`: http://help.github.com/fork-a-repo/
  311. .. _`Rebasing merge commits in git`:
  312. http://notes.envato.com/developers/rebasing-merge-commits-in-git/
  313. .. _`Rebase`: http://help.github.com/rebase/
  314. .. _contributing-testing:
  315. Running the unit test suite
  316. ---------------------------
  317. To run the Celery test suite you need to install a few dependencies.
  318. A complete list of the dependencies needed are located in
  319. :file:`requirements/test.txt`.
  320. If you're working on the development version, then you need to
  321. install the development requirements first:
  322. .. code-block:: console
  323. $ pip install -U -r requirements/dev.txt
  324. Both the stable and the development version have testing related
  325. dependencies, so install these next:
  326. .. code-block:: console
  327. $ pip install -U -r requirements/test.txt
  328. $ pip install -U -r requirements/default.txt
  329. After installing the dependencies required, you can now execute
  330. the test suite by calling :pypi:`nosetests <nose>`:
  331. .. code-block:: console
  332. $ nosetests
  333. Some useful options to :command:`nosetests` are:
  334. * ``-x``
  335. Stop running the tests at the first test that fails.
  336. * ``-s``
  337. Don't capture output
  338. * ``-nologcapture``
  339. Don't capture log output.
  340. * ``-v``
  341. Run with verbose output.
  342. If you want to run the tests for a single test file only
  343. you can do so like this:
  344. .. code-block:: console
  345. $ nosetests celery.tests.test_worker.test_worker_job
  346. .. _contributing-pull-requests:
  347. Creating pull requests
  348. ----------------------
  349. When your feature/bugfix is complete you may want to submit
  350. a pull requests so that it can be reviewed by the maintainers.
  351. Creating pull requests is easy, and also let you track the progress
  352. of your contribution. Read the `Pull Requests`_ section in the GitHub
  353. Guide to learn how this is done.
  354. You can also attach pull requests to existing issues by following
  355. the steps outlined here: http://bit.ly/koJoso
  356. .. _`Pull Requests`: http://help.github.com/send-pull-requests/
  357. .. _contributing-coverage:
  358. Calculating test coverage
  359. ~~~~~~~~~~~~~~~~~~~~~~~~~
  360. To calculate test coverage you must first install the :pypi:`coverage` module.
  361. Installing the :pypi:`coverage` module:
  362. .. code-block:: console
  363. $ pip install -U coverage
  364. Code coverage in HTML:
  365. .. code-block:: console
  366. $ nosetests --with-coverage --cover-html
  367. The coverage output will then be located at
  368. :file:`celery/tests/cover/index.html`.
  369. Code coverage in XML (Cobertura-style):
  370. .. code-block:: console
  371. $ nosetests --with-coverage --cover-xml --cover-xml-file=coverage.xml
  372. The coverage XML output will then be located at :file:`coverage.xml`
  373. .. _contributing-tox:
  374. Running the tests on all supported Python versions
  375. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  376. There's a :pypi:`tox` configuration file in the top directory of the
  377. distribution.
  378. To run the tests for all supported Python versions simply execute:
  379. .. code-block:: console
  380. $ tox
  381. Use the ``tox -e`` option if you only want to test specific Python versions:
  382. .. code-block:: console
  383. $ tox -e 2.7
  384. Building the documentation
  385. --------------------------
  386. To build the documentation you need to install the dependencies
  387. listed in :file:`requirements/docs.txt`:
  388. .. code-block:: console
  389. $ pip install -U -r requirements/docs.txt
  390. After these dependencies are installed you should be able to
  391. build the docs by running:
  392. .. code-block:: console
  393. $ cd docs
  394. $ rm -rf _build
  395. $ make html
  396. Make sure there are no errors or warnings in the build output.
  397. After building succeeds the documentation is available at :file:`_build/html`.
  398. .. _contributing-verify:
  399. Verifying your contribution
  400. ---------------------------
  401. To use these tools you need to install a few dependencies. These dependencies
  402. can be found in :file:`requirements/pkgutils.txt`.
  403. Installing the dependencies:
  404. .. code-block:: console
  405. $ pip install -U -r requirements/pkgutils.txt
  406. pyflakes & PEP-8
  407. ~~~~~~~~~~~~~~~~
  408. To ensure that your changes conform to :pep:`8` and to run pyflakes
  409. execute:
  410. .. code-block:: console
  411. $ make flakecheck
  412. To not return a negative exit code when this command fails use
  413. the ``flakes`` target instead:
  414. .. code-block:: console
  415. $ make flakes§
  416. API reference
  417. ~~~~~~~~~~~~~
  418. To make sure that all modules have a corresponding section in the API
  419. reference please execute:
  420. .. code-block:: console
  421. $ make apicheck
  422. $ make indexcheck
  423. If files are missing you can add them by copying an existing reference file.
  424. If the module is internal it should be part of the internal reference
  425. located in :file:`docs/internals/reference/`. If the module is public
  426. it should be located in :file:`docs/reference/`.
  427. For example if reference is missing for the module ``celery.worker.awesome``
  428. and this module is considered part of the public API, use the following steps:
  429. Use an existing file as a template:
  430. .. code-block:: console
  431. $ cd docs/reference/
  432. $ cp celery.schedules.rst celery.worker.awesome.rst
  433. Edit the file using your favorite editor:
  434. .. code-block:: console
  435. $ vim celery.worker.awesome.rst
  436. # change every occurrence of ``celery.schedules`` to
  437. # ``celery.worker.awesome``
  438. Edit the index using your favorite editor:
  439. .. code-block:: console
  440. $ vim index.rst
  441. # Add ``celery.worker.awesome`` to the index.
  442. Commit your changes:
  443. .. code-block:: console
  444. # Add the file to git
  445. $ git add celery.worker.awesome.rst
  446. $ git add index.rst
  447. $ git commit celery.worker.awesome.rst index.rst \
  448. -m "Adds reference for celery.worker.awesome"
  449. .. _coding-style:
  450. Coding Style
  451. ============
  452. You should probably be able to pick up the coding style
  453. from surrounding code, but it is a good idea to be aware of the
  454. following conventions.
  455. * All Python code must follow the :pep:`8` guidelines.
  456. :pypi:`pep8` is a utility you can use to verify that your code
  457. is following the conventions.
  458. * Docstrings must follow the :pep:`257` conventions, and use the following
  459. style.
  460. Do this:
  461. .. code-block:: python
  462. def method(self, arg):
  463. """Short description.
  464. More details.
  465. """
  466. or:
  467. .. code-block:: python
  468. def method(self, arg):
  469. """Short description."""
  470. but not this:
  471. .. code-block:: python
  472. def method(self, arg):
  473. """
  474. Short description.
  475. """
  476. * Lines shouldn't exceed 78 columns.
  477. You can enforce this in :command:`vim` by setting the ``textwidth`` option:
  478. .. code-block:: vim
  479. set textwidth=78
  480. If adhering to this limit makes the code less readable, you have one more
  481. character to go on. This means 78 is a soft limit, and 79 is the hard
  482. limit :)
  483. * Import order
  484. * Python standard library (`import xxx`)
  485. * Python standard library ('from xxx import`)
  486. * Third-party packages.
  487. * Other modules from the current package.
  488. or in case of code using Django:
  489. * Python standard library (`import xxx`)
  490. * Python standard library ('from xxx import`)
  491. * Third-party packages.
  492. * Django packages.
  493. * Other modules from the current package.
  494. Within these sections the imports should be sorted by module name.
  495. Example:
  496. .. code-block:: python
  497. import threading
  498. import time
  499. from collections import deque
  500. from Queue import Queue, Empty
  501. from .platforms import Pidfile
  502. from .five import zip_longest, items, range
  503. from .utils import timeutils
  504. * Wild-card imports must not be used (`from xxx import *`).
  505. * For distributions where Python 2.5 is the oldest support version
  506. additional rules apply:
  507. * Absolute imports must be enabled at the top of every module::
  508. from __future__ import absolute_import
  509. * If the module uses the :keyword:`with` statement and must be compatible
  510. with Python 2.5 (celery isn't) then it must also enable that::
  511. from __future__ import with_statement
  512. * Every future import must be on its own line, as older Python 2.5
  513. releases didn't support importing multiple features on the
  514. same future import line::
  515. # Good
  516. from __future__ import absolute_import
  517. from __future__ import with_statement
  518. # Bad
  519. from __future__ import absolute_import, with_statement
  520. (Note that this rule doesn't apply if the package doesn't include
  521. support for Python 2.5)
  522. * Note that we use "new-style` relative imports when the distribution
  523. doesn't support Python versions below 2.5
  524. This requires Python 2.5 or later:
  525. .. code-block:: python
  526. from . import submodule
  527. .. _feature-with-extras:
  528. Contributing features requiring additional libraries
  529. ====================================================
  530. Some features like a new result backend may require additional libraries
  531. that the user must install.
  532. We use setuptools `extra_requires` for this, and all new optional features
  533. that require third-party libraries must be added.
  534. 1) Add a new requirements file in `requirements/extras`
  535. For the Cassandra backend this is
  536. :file:`requirements/extras/cassandra.txt`, and the file looks like this:
  537. .. code-block:: text
  538. pycassa
  539. These are pip requirement files so you can have version specifiers and
  540. multiple packages are separated by newline. A more complex example could
  541. be:
  542. .. code-block:: text
  543. # pycassa 2.0 breaks Foo
  544. pycassa>=1.0,<2.0
  545. thrift
  546. 2) Modify ``setup.py``
  547. After the requirements file is added you need to add it as an option
  548. to :file:`setup.py` in the ``extras_require`` section::
  549. extra['extras_require'] = {
  550. # ...
  551. 'cassandra': extras('cassandra.txt'),
  552. }
  553. 3) Document the new feature in :file:`docs/includes/installation.txt`
  554. You must add your feature to the list in the :ref:`bundles` section
  555. of :file:`docs/includes/installation.txt`.
  556. After you've made changes to this file you need to render
  557. the distro :file:`README` file:
  558. .. code-block:: console
  559. $ pip install -U requirements/pkgutils.txt
  560. $ make readme
  561. That's all that needs to be done, but remember that if your feature
  562. adds additional configuration options then these needs to be documented
  563. in :file:`docs/configuration.rst`. Also all settings need to be added to the
  564. :file:`celery/app/defaults.py` module.
  565. Result backends require a separate section in the :file:`docs/configuration.rst`
  566. file.
  567. .. _contact_information:
  568. Contacts
  569. ========
  570. This is a list of people that can be contacted for questions
  571. regarding the official git repositories, PyPI packages
  572. Read the Docs pages.
  573. If the issue isn't an emergency then it's better
  574. to :ref:`report an issue <reporting-bugs>`.
  575. Committers
  576. ----------
  577. Ask Solem
  578. ~~~~~~~~~
  579. :github: https://github.com/ask
  580. :twitter: http://twitter.com/#!/asksol
  581. Dmitry Malinovsky
  582. ~~~~~~~~~~~~~~~~~
  583. :github: https://github.com/malinoff
  584. :twitter: https://twitter.com/__malinoff__
  585. Ionel Cristian Mărieș
  586. ~~~~~~~~~~~~~~~~~~~~~
  587. :github: https://github.com/ionelmc
  588. :twitter: https://twitter.com/ionelmc
  589. Mher Movsisyan
  590. ~~~~~~~~~~~~~~
  591. :github: https://github.com/mher
  592. :twitter: http://twitter.com/#!/movsm
  593. Omer Katz
  594. ~~~~~~~~~
  595. :github: https://github.com/thedrow
  596. :twitter: https://twitter.com/the_drow
  597. Steeve Morin
  598. ~~~~~~~~~~~~
  599. :github: https://github.com/steeve
  600. :twitter: http://twitter.com/#!/steeve
  601. Website
  602. -------
  603. The Celery Project website is run and maintained by
  604. Mauro Rocco
  605. ~~~~~~~~~~~
  606. :github: https://github.com/fireantology
  607. :twitter: https://twitter.com/#!/fireantology
  608. with design by:
  609. Jan Henrik Helmers
  610. ~~~~~~~~~~~~~~~~~~
  611. :web: http://www.helmersworks.com
  612. :twitter: http://twitter.com/#!/helmers
  613. .. _packages:
  614. Packages
  615. ========
  616. ``celery``
  617. ----------
  618. :git: https://github.com/celery/celery
  619. :CI: http://travis-ci.org/#!/celery/celery
  620. :Windows-CI: https://ci.appveyor.com/project/ask/celery
  621. :PyPI: :pypi:`celery`
  622. :docs: http://docs.celeryproject.org
  623. ``kombu``
  624. ---------
  625. Messaging library.
  626. :git: https://github.com/celery/kombu
  627. :CI: http://travis-ci.org/#!/celery/kombu
  628. :Windows-CI: https://ci.appveyor.com/project/ask/kombu
  629. :PyPI: :pypi:`kombu`
  630. :docs: https://kombu.readthedocs.io
  631. ``amqp``
  632. --------
  633. Python AMQP 0.9.1 client.
  634. :git: https://github.com/celery/py-amqp
  635. :CI: http://travis-ci.org/#!/celery/py-amqp
  636. :Windows-CI: https://ci.appveyor.com/project/ask/py-amqp
  637. :PyPI: :pypi:`amqp`
  638. :docs: https://amqp.readthedocs.io
  639. ``vine``
  640. --------
  641. Promise/deferred implementation.
  642. :git: https://github.com/celery/vine/
  643. :CI: http://travis-ci.org/#!/celery/vine/
  644. :Windows-CI: https://ci.appveyor.com/project/ask/vine
  645. :PyPI: :pypi:`vine`
  646. :docs: https://vine.readthedocs.io
  647. ``billiard``
  648. ------------
  649. Fork of multiprocessing containing improvements
  650. that'll eventually be merged into the Python stdlib.
  651. :git: https://github.com/celery/billiard
  652. :CI: http://travis-ci.org/#!/celery/billiard/
  653. :Windows-CI: https://ci.appveyor.com/project/ask/billiard
  654. :PyPI: :pypi:`billiard`
  655. ``librabbitmq``
  656. ---------------
  657. Very fast Python AMQP client written in C.
  658. :git: https://github.com/celery/librabbitmq
  659. :PyPI: :pypi:`librabbitmq`
  660. ``django-celery``
  661. -----------------
  662. Django <-> Celery Integration.
  663. :git: https://github.com/celery/django-celery
  664. :PyPI: :pypi:`django-celery`
  665. :docs: http://docs.celeryproject.org/en/latest/django
  666. ``cell``
  667. --------
  668. Actor library.
  669. :git: https://github.com/celery/cell
  670. :PyPI: :pypi:`cell`
  671. ``cyme``
  672. --------
  673. Distributed Celery Instance manager.
  674. :git: https://github.com/celery/cyme
  675. :PyPI: :pypi:`cyme`
  676. :docs: https://cyme.readthedocs.io/
  677. Deprecated
  678. ----------
  679. - ``Flask-Celery``
  680. :git: https://github.com/ask/Flask-Celery
  681. :PyPI: :pypi:`Flask-Celery`
  682. - ``celerymon``
  683. :git: https://github.com/celery/celerymon
  684. :PyPI: :pypi:`celerymon`
  685. - ``carrot``
  686. :git: https://github.com/ask/carrot
  687. :PyPI: :pypi:`carrot`
  688. - ``ghettoq``
  689. :git: https://github.com/ask/ghettoq
  690. :PyPI: :pypi:`ghettoq`
  691. - ``kombu-sqlalchemy``
  692. :git: https://github.com/ask/kombu-sqlalchemy
  693. :PyPI: :pypi:`kombu-sqlalchemy`
  694. - ``django-kombu``
  695. :git: https://github.com/ask/django-kombu
  696. :PyPI: :pypi:`django-kombu`
  697. - ``pylibrabbitmq``
  698. Old name for :pypi:`librabbitmq`.
  699. :git: :const:`None`
  700. :PyPI: :pypi:`pylibrabbitmq`
  701. .. _release-procedure:
  702. Release Procedure
  703. =================
  704. Updating the version number
  705. ---------------------------
  706. The version number must be updated two places:
  707. * :file:`celery/__init__.py`
  708. * :file:`docs/include/introduction.txt`
  709. After you have changed these files you must render
  710. the :file:`README` files. There's a script to convert sphinx syntax
  711. to generic reStructured Text syntax, and the make target `readme`
  712. does this for you:
  713. .. code-block:: console
  714. $ make readme
  715. Now commit the changes:
  716. .. code-block:: console
  717. $ git commit -a -m "Bumps version to X.Y.Z"
  718. and make a new version tag:
  719. .. code-block:: console
  720. $ git tag vX.Y.Z
  721. $ git push --tags
  722. Releasing
  723. ---------
  724. Commands to make a new public stable release:
  725. .. code-block:: console
  726. $ make distcheck # checks pep8, autodoc index, runs tests and more
  727. $ make dist # NOTE: Runs git clean -xdf and removes files not in the repo.
  728. $ python setup.py sdist upload --sign --identity='Celery Security Team'
  729. $ python setup.py bdist_wheel upload --sign --identity='Celery Security Team'
  730. If this is a new release series then you also need to do the
  731. following:
  732. * Go to the Read The Docs management interface at:
  733. http://readthedocs.org/projects/celery/?fromdocs=celery
  734. * Enter "Edit project"
  735. Change default branch to the branch of this series, for example, use
  736. the ``2.4`` branch for the 2.4 series.
  737. * Also add the previous version under the "versions" tab.