contributing.rst 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165
  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-beat`: https://github.com/celery/django-celery-beat/issues
  193. * :pypi:`django-celery-results`: https://github.com/celery/django-celery-results/issues
  194. If you're unsure of the origin of the bug you can ask the
  195. :ref:`mailing-list`, or just use the Celery issue tracker.
  196. Contributors guide to the code base
  197. ===================================
  198. There's a separate section for internal details,
  199. including details about the code base and a style guide.
  200. Read :ref:`internals-guide` for more!
  201. .. _versions:
  202. Versions
  203. ========
  204. Version numbers consists of a major version, minor version and a release number.
  205. Since version 2.1.0 we use the versioning semantics described by
  206. SemVer: http://semver.org.
  207. Stable releases are published at PyPI
  208. while development releases are only available in the GitHub git repository as tags.
  209. All version tags starts with “v”, so version 0.8.0 is the tag v0.8.0.
  210. .. _git-branches:
  211. Branches
  212. ========
  213. Current active version branches:
  214. * dev (which git calls "master") (https://github.com/celery/celery/tree/master)
  215. * 3.1 (https://github.com/celery/celery/tree/3.1)
  216. * 3.0 (https://github.com/celery/celery/tree/3.0)
  217. You can see the state of any branch by looking at the Changelog:
  218. https://github.com/celery/celery/blob/master/Changelog
  219. If the branch is in active development the topmost version info should
  220. contain meta-data like:
  221. .. code-block:: restructuredtext
  222. 2.4.0
  223. ======
  224. :release-date: TBA
  225. :status: DEVELOPMENT
  226. :branch: dev (git calls this master)
  227. The ``status`` field can be one of:
  228. * ``PLANNING``
  229. The branch is currently experimental and in the planning stage.
  230. * ``DEVELOPMENT``
  231. The branch is in active development, but the test suite should
  232. be passing and the product should be working and possible for users to test.
  233. * ``FROZEN``
  234. The branch is frozen, and no more features will be accepted.
  235. When a branch is frozen the focus is on testing the version as much
  236. as possible before it is released.
  237. dev branch
  238. ----------
  239. The dev branch (called "master" by git), is where development of the next
  240. version happens.
  241. Maintenance branches
  242. --------------------
  243. Maintenance branches are named after the version -- for example,
  244. the maintenance branch for the 2.2.x series is named ``2.2``.
  245. Previously these were named ``releaseXX-maint``.
  246. The versions we currently maintain is:
  247. * 3.1
  248. This is the current series.
  249. * 3.0
  250. This is the previous series, and the last version to support Python 2.5.
  251. Archived branches
  252. -----------------
  253. Archived branches are kept for preserving history only,
  254. and theoretically someone could provide patches for these if they depend
  255. on a series that's no longer officially supported.
  256. An archived version is named ``X.Y-archived``.
  257. Our currently archived branches are:
  258. * :github_branch:`2.5-archived`
  259. * :github_branch:`2.4-archived`
  260. * :github_branch:`2.3-archived`
  261. * :github_branch:`2.1-archived`
  262. * :github_branch:`2.0-archived`
  263. * :github_branch:`1.0-archived`
  264. Feature branches
  265. ----------------
  266. Major new features are worked on in dedicated branches.
  267. There's no strict naming requirement for these branches.
  268. Feature branches are removed once they've been merged into a release branch.
  269. Tags
  270. ====
  271. - Tags are used exclusively for tagging releases. A release tag is
  272. named with the format ``vX.Y.Z`` -- for example ``v2.3.1``.
  273. - Experimental releases contain an additional identifier ``vX.Y.Z-id`` --
  274. for example ``v3.0.0-rc1``.
  275. - Experimental tags may be removed after the official release.
  276. .. _contributing-changes:
  277. Working on Features & Patches
  278. =============================
  279. .. note::
  280. Contributing to Celery should be as simple as possible,
  281. so none of these steps should be considered mandatory.
  282. You can even send in patches by email if that's your preferred
  283. work method. We won't like you any less, any contribution you make
  284. is always appreciated!
  285. However following these steps may make maintainers life easier,
  286. and may mean that your changes will be accepted sooner.
  287. Forking and setting up the repository
  288. -------------------------------------
  289. First you need to fork the Celery repository, a good introduction to this
  290. is in the GitHub Guide: `Fork a Repo`_.
  291. After you have cloned the repository you should checkout your copy
  292. to a directory on your machine:
  293. .. code-block:: console
  294. $ git clone git@github.com:username/celery.git
  295. When the repository is cloned enter the directory to set up easy access
  296. to upstream changes:
  297. .. code-block:: console
  298. $ cd celery
  299. $ git remote add upstream git://github.com/celery/celery.git
  300. $ git fetch upstream
  301. If you need to pull in new changes from upstream you should
  302. always use the ``--rebase`` option to ``git pull``:
  303. .. code-block:: console
  304. git pull --rebase upstream master
  305. With this option you don't clutter the history with merging
  306. commit notes. See `Rebasing merge commits in git`_.
  307. If you want to learn more about rebasing see the `Rebase`_
  308. section in the GitHub guides.
  309. If you need to work on a different branch than the one git calls ``master``, you can
  310. fetch and checkout a remote branch like this::
  311. git checkout --track -b 3.0-devel origin/3.0-devel
  312. .. _`Fork a Repo`: http://help.github.com/fork-a-repo/
  313. .. _`Rebasing merge commits in git`:
  314. http://notes.envato.com/developers/rebasing-merge-commits-in-git/
  315. .. _`Rebase`: http://help.github.com/rebase/
  316. .. _contributing-testing:
  317. Running the unit test suite
  318. ---------------------------
  319. To run the Celery test suite you need to install a few dependencies.
  320. A complete list of the dependencies needed are located in
  321. :file:`requirements/test.txt`.
  322. If you're working on the development version, then you need to
  323. install the development requirements first:
  324. .. code-block:: console
  325. $ pip install -U -r requirements/dev.txt
  326. THIS REQUIREMENT FILE MAY NOT BE PRESENT, SKIP IF NOT FOUND.
  327. Both the stable and the development version have testing related
  328. dependencies, so install these next:
  329. .. code-block:: console
  330. $ pip install -U -r requirements/test.txt
  331. $ pip install -U -r requirements/default.txt
  332. After installing the dependencies required, you can now execute
  333. the test suite by calling :pypi:`py.test <pytest`:
  334. .. code-block:: console
  335. $ py.test
  336. Some useful options to :command:`py.test` are:
  337. * ``-x``
  338. Stop running the tests at the first test that fails.
  339. * ``-s``
  340. Don't capture output
  341. * ``-v``
  342. Run with verbose output.
  343. If you want to run the tests for a single test file only
  344. you can do so like this:
  345. .. code-block:: console
  346. $ py.test t/unit/worker/test_worker_job.py
  347. .. _contributing-pull-requests:
  348. Creating pull requests
  349. ----------------------
  350. When your feature/bugfix is complete you may want to submit
  351. a pull requests so that it can be reviewed by the maintainers.
  352. Creating pull requests is easy, and also let you track the progress
  353. of your contribution. Read the `Pull Requests`_ section in the GitHub
  354. Guide to learn how this is done.
  355. You can also attach pull requests to existing issues by following
  356. the steps outlined here: http://bit.ly/koJoso
  357. .. _`Pull Requests`: http://help.github.com/send-pull-requests/
  358. .. _contributing-coverage:
  359. Calculating test coverage
  360. ~~~~~~~~~~~~~~~~~~~~~~~~~
  361. To calculate test coverage you must first install the :pypi:`pytest-cov` module.
  362. Installing the :pypi:`pytest-cov` module:
  363. .. code-block:: console
  364. $ pip install -U pytest-cov
  365. Code coverage in HTML format
  366. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  367. #. Run :command:`py.test` with the ``--cov-report=html`` argument enabled:
  368. .. code-block:: console
  369. $ py.test --cov=celery --cov-report=html
  370. #. The coverage output will then be located in the :file:`htmlcov/` directory:
  371. .. code-block:: console
  372. $ open htmlcov/index.html
  373. Code coverage in XML (Cobertura-style)
  374. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  375. #. Run :command:`py.test` with the ``--cov-report=xml`` argument enabled:
  376. .. code-block:: console
  377. $ py.test --cov=celery --cov-report=xml
  378. #. The coverage XML output will then be located in the :file:`coverage.xml` file.
  379. .. _contributing-tox:
  380. Running the tests on all supported Python versions
  381. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  382. There's a :pypi:`tox` configuration file in the top directory of the
  383. distribution.
  384. To run the tests for all supported Python versions simply execute:
  385. .. code-block:: console
  386. $ tox
  387. Use the ``tox -e`` option if you only want to test specific Python versions:
  388. .. code-block:: console
  389. $ tox -e 2.7
  390. Building the documentation
  391. --------------------------
  392. To build the documentation you need to install the dependencies
  393. listed in :file:`requirements/docs.txt`:
  394. .. code-block:: console
  395. $ pip install -U -r requirements/docs.txt
  396. After these dependencies are installed you should be able to
  397. build the docs by running:
  398. .. code-block:: console
  399. $ cd docs
  400. $ rm -rf _build
  401. $ make html
  402. Make sure there are no errors or warnings in the build output.
  403. After building succeeds the documentation is available at :file:`_build/html`.
  404. .. _contributing-verify:
  405. Verifying your contribution
  406. ---------------------------
  407. To use these tools you need to install a few dependencies. These dependencies
  408. can be found in :file:`requirements/pkgutils.txt`.
  409. Installing the dependencies:
  410. .. code-block:: console
  411. $ pip install -U -r requirements/pkgutils.txt
  412. pyflakes & PEP-8
  413. ~~~~~~~~~~~~~~~~
  414. To ensure that your changes conform to :pep:`8` and to run pyflakes
  415. execute:
  416. .. code-block:: console
  417. $ make flakecheck
  418. To not return a negative exit code when this command fails use
  419. the ``flakes`` target instead:
  420. .. code-block:: console
  421. $ make flakes§
  422. API reference
  423. ~~~~~~~~~~~~~
  424. To make sure that all modules have a corresponding section in the API
  425. reference please execute:
  426. .. code-block:: console
  427. $ make apicheck
  428. $ make indexcheck
  429. If files are missing you can add them by copying an existing reference file.
  430. If the module is internal it should be part of the internal reference
  431. located in :file:`docs/internals/reference/`. If the module is public
  432. it should be located in :file:`docs/reference/`.
  433. For example if reference is missing for the module ``celery.worker.awesome``
  434. and this module is considered part of the public API, use the following steps:
  435. Use an existing file as a template:
  436. .. code-block:: console
  437. $ cd docs/reference/
  438. $ cp celery.schedules.rst celery.worker.awesome.rst
  439. Edit the file using your favorite editor:
  440. .. code-block:: console
  441. $ vim celery.worker.awesome.rst
  442. # change every occurrence of ``celery.schedules`` to
  443. # ``celery.worker.awesome``
  444. Edit the index using your favorite editor:
  445. .. code-block:: console
  446. $ vim index.rst
  447. # Add ``celery.worker.awesome`` to the index.
  448. Commit your changes:
  449. .. code-block:: console
  450. # Add the file to git
  451. $ git add celery.worker.awesome.rst
  452. $ git add index.rst
  453. $ git commit celery.worker.awesome.rst index.rst \
  454. -m "Adds reference for celery.worker.awesome"
  455. .. _coding-style:
  456. Coding Style
  457. ============
  458. You should probably be able to pick up the coding style
  459. from surrounding code, but it is a good idea to be aware of the
  460. following conventions.
  461. * All Python code must follow the :pep:`8` guidelines.
  462. :pypi:`pep8` is a utility you can use to verify that your code
  463. is following the conventions.
  464. * Docstrings must follow the :pep:`257` conventions, and use the following
  465. style.
  466. Do this:
  467. .. code-block:: python
  468. def method(self, arg):
  469. """Short description.
  470. More details.
  471. """
  472. or:
  473. .. code-block:: python
  474. def method(self, arg):
  475. """Short description."""
  476. but not this:
  477. .. code-block:: python
  478. def method(self, arg):
  479. """
  480. Short description.
  481. """
  482. * Lines shouldn't exceed 78 columns.
  483. You can enforce this in :command:`vim` by setting the ``textwidth`` option:
  484. .. code-block:: vim
  485. set textwidth=78
  486. If adhering to this limit makes the code less readable, you have one more
  487. character to go on. This means 78 is a soft limit, and 79 is the hard
  488. limit :)
  489. * Import order
  490. * Python standard library (`import xxx`)
  491. * Python standard library ('from xxx import`)
  492. * Third-party packages.
  493. * Other modules from the current package.
  494. or in case of code using Django:
  495. * Python standard library (`import xxx`)
  496. * Python standard library ('from xxx import`)
  497. * Third-party packages.
  498. * Django packages.
  499. * Other modules from the current package.
  500. Within these sections the imports should be sorted by module name.
  501. Example:
  502. .. code-block:: python
  503. import threading
  504. import time
  505. from collections import deque
  506. from Queue import Queue, Empty
  507. from .platforms import Pidfile
  508. from .five import zip_longest, items, range
  509. from .utils.time import maybe_timedelta
  510. * Wild-card imports must not be used (`from xxx import *`).
  511. * For distributions where Python 2.5 is the oldest support version
  512. additional rules apply:
  513. * Absolute imports must be enabled at the top of every module::
  514. from __future__ import absolute_import
  515. * If the module uses the :keyword:`with` statement and must be compatible
  516. with Python 2.5 (celery isn't) then it must also enable that::
  517. from __future__ import with_statement
  518. * Every future import must be on its own line, as older Python 2.5
  519. releases didn't support importing multiple features on the
  520. same future import line::
  521. # Good
  522. from __future__ import absolute_import
  523. from __future__ import with_statement
  524. # Bad
  525. from __future__ import absolute_import, with_statement
  526. (Note that this rule doesn't apply if the package doesn't include
  527. support for Python 2.5)
  528. * Note that we use "new-style` relative imports when the distribution
  529. doesn't support Python versions below 2.5
  530. This requires Python 2.5 or later:
  531. .. code-block:: python
  532. from . import submodule
  533. .. _feature-with-extras:
  534. Contributing features requiring additional libraries
  535. ====================================================
  536. Some features like a new result backend may require additional libraries
  537. that the user must install.
  538. We use setuptools `extra_requires` for this, and all new optional features
  539. that require third-party libraries must be added.
  540. 1) Add a new requirements file in `requirements/extras`
  541. For the Cassandra backend this is
  542. :file:`requirements/extras/cassandra.txt`, and the file looks like this:
  543. .. code-block:: text
  544. pycassa
  545. These are pip requirement files so you can have version specifiers and
  546. multiple packages are separated by newline. A more complex example could
  547. be:
  548. .. code-block:: text
  549. # pycassa 2.0 breaks Foo
  550. pycassa>=1.0,<2.0
  551. thrift
  552. 2) Modify ``setup.py``
  553. After the requirements file is added you need to add it as an option
  554. to :file:`setup.py` in the ``extras_require`` section::
  555. extra['extras_require'] = {
  556. # ...
  557. 'cassandra': extras('cassandra.txt'),
  558. }
  559. 3) Document the new feature in :file:`docs/includes/installation.txt`
  560. You must add your feature to the list in the :ref:`bundles` section
  561. of :file:`docs/includes/installation.txt`.
  562. After you've made changes to this file you need to render
  563. the distro :file:`README` file:
  564. .. code-block:: console
  565. $ pip install -U requirements/pkgutils.txt
  566. $ make readme
  567. That's all that needs to be done, but remember that if your feature
  568. adds additional configuration options then these needs to be documented
  569. in :file:`docs/configuration.rst`. Also all settings need to be added to the
  570. :file:`celery/app/defaults.py` module.
  571. Result backends require a separate section in the :file:`docs/configuration.rst`
  572. file.
  573. .. _contact_information:
  574. Contacts
  575. ========
  576. This is a list of people that can be contacted for questions
  577. regarding the official git repositories, PyPI packages
  578. Read the Docs pages.
  579. If the issue isn't an emergency then it's better
  580. to :ref:`report an issue <reporting-bugs>`.
  581. Committers
  582. ----------
  583. Ask Solem
  584. ~~~~~~~~~
  585. :github: https://github.com/ask
  586. :twitter: http://twitter.com/#!/asksol
  587. Asif Saif Uddin
  588. ~~~~~~~~~~~~~~~
  589. :github: https://github.com/auvipy
  590. :twitter: https://twitter.com/#!/auvipy
  591. Dmitry Malinovsky
  592. ~~~~~~~~~~~~~~~~~
  593. :github: https://github.com/malinoff
  594. :twitter: https://twitter.com/__malinoff__
  595. Ionel Cristian Mărieș
  596. ~~~~~~~~~~~~~~~~~~~~~
  597. :github: https://github.com/ionelmc
  598. :twitter: https://twitter.com/ionelmc
  599. Mher Movsisyan
  600. ~~~~~~~~~~~~~~
  601. :github: https://github.com/mher
  602. :twitter: http://twitter.com/#!/movsm
  603. Omer Katz
  604. ~~~~~~~~~
  605. :github: https://github.com/thedrow
  606. :twitter: https://twitter.com/the_drow
  607. Steeve Morin
  608. ~~~~~~~~~~~~
  609. :github: https://github.com/steeve
  610. :twitter: http://twitter.com/#!/steeve
  611. Website
  612. -------
  613. The Celery Project website is run and maintained by
  614. Mauro Rocco
  615. ~~~~~~~~~~~
  616. :github: https://github.com/fireantology
  617. :twitter: https://twitter.com/#!/fireantology
  618. with design by:
  619. Jan Henrik Helmers
  620. ~~~~~~~~~~~~~~~~~~
  621. :web: http://www.helmersworks.com
  622. :twitter: http://twitter.com/#!/helmers
  623. .. _packages:
  624. Packages
  625. ========
  626. ``celery``
  627. ----------
  628. :git: https://github.com/celery/celery
  629. :CI: http://travis-ci.org/#!/celery/celery
  630. :Windows-CI: https://ci.appveyor.com/project/ask/celery
  631. :PyPI: :pypi:`celery`
  632. :docs: http://docs.celeryproject.org
  633. ``kombu``
  634. ---------
  635. Messaging library.
  636. :git: https://github.com/celery/kombu
  637. :CI: http://travis-ci.org/#!/celery/kombu
  638. :Windows-CI: https://ci.appveyor.com/project/ask/kombu
  639. :PyPI: :pypi:`kombu`
  640. :docs: https://kombu.readthedocs.io
  641. ``amqp``
  642. --------
  643. Python AMQP 0.9.1 client.
  644. :git: https://github.com/celery/py-amqp
  645. :CI: http://travis-ci.org/#!/celery/py-amqp
  646. :Windows-CI: https://ci.appveyor.com/project/ask/py-amqp
  647. :PyPI: :pypi:`amqp`
  648. :docs: https://amqp.readthedocs.io
  649. ``vine``
  650. --------
  651. Promise/deferred implementation.
  652. :git: https://github.com/celery/vine/
  653. :CI: http://travis-ci.org/#!/celery/vine/
  654. :Windows-CI: https://ci.appveyor.com/project/ask/vine
  655. :PyPI: :pypi:`vine`
  656. :docs: https://vine.readthedocs.io
  657. ``billiard``
  658. ------------
  659. Fork of multiprocessing containing improvements
  660. that'll eventually be merged into the Python stdlib.
  661. :git: https://github.com/celery/billiard
  662. :CI: http://travis-ci.org/#!/celery/billiard/
  663. :Windows-CI: https://ci.appveyor.com/project/ask/billiard
  664. :PyPI: :pypi:`billiard`
  665. ``django-celery-beat``
  666. ----------------------
  667. Database-backed Periodic Tasks with admin interface using the Django ORM.
  668. :git: https://github.com/celery/django-celery-beat
  669. :CI: http://travis-ci.org/#!/celery/django-celery-beat
  670. :Windows-CI: https://ci.appveyor.com/project/ask/django-celery-beat
  671. :PyPI: :pypi:`django-celery-beat`
  672. ``django-celery-results``
  673. -------------------------
  674. Store task results in the Django ORM, or using the Django Cache Framework.
  675. :git: https://github.com/celery/django-celery-results
  676. :CI: http://travis-ci.org/#!/celery/django-celery-results
  677. :Windows-CI: https://ci.appveyor.com/project/ask/django-celery-results
  678. :PyPI: :pypi:`django-celery-results`
  679. ``librabbitmq``
  680. ---------------
  681. Very fast Python AMQP client written in C.
  682. :git: https://github.com/celery/librabbitmq
  683. :PyPI: :pypi:`librabbitmq`
  684. ``cell``
  685. --------
  686. Actor library.
  687. :git: https://github.com/celery/cell
  688. :PyPI: :pypi:`cell`
  689. ``cyme``
  690. --------
  691. Distributed Celery Instance manager.
  692. :git: https://github.com/celery/cyme
  693. :PyPI: :pypi:`cyme`
  694. :docs: https://cyme.readthedocs.io/
  695. Deprecated
  696. ----------
  697. - ``django-celery``
  698. :git: https://github.com/celery/django-celery
  699. :PyPI: :pypi:`django-celery`
  700. :docs: http://docs.celeryproject.org/en/latest/django
  701. - ``Flask-Celery``
  702. :git: https://github.com/ask/Flask-Celery
  703. :PyPI: :pypi:`Flask-Celery`
  704. - ``celerymon``
  705. :git: https://github.com/celery/celerymon
  706. :PyPI: :pypi:`celerymon`
  707. - ``carrot``
  708. :git: https://github.com/ask/carrot
  709. :PyPI: :pypi:`carrot`
  710. - ``ghettoq``
  711. :git: https://github.com/ask/ghettoq
  712. :PyPI: :pypi:`ghettoq`
  713. - ``kombu-sqlalchemy``
  714. :git: https://github.com/ask/kombu-sqlalchemy
  715. :PyPI: :pypi:`kombu-sqlalchemy`
  716. - ``django-kombu``
  717. :git: https://github.com/ask/django-kombu
  718. :PyPI: :pypi:`django-kombu`
  719. - ``pylibrabbitmq``
  720. Old name for :pypi:`librabbitmq`.
  721. :git: :const:`None`
  722. :PyPI: :pypi:`pylibrabbitmq`
  723. .. _release-procedure:
  724. Release Procedure
  725. =================
  726. Updating the version number
  727. ---------------------------
  728. The version number must be updated two places:
  729. * :file:`celery/__init__.py`
  730. * :file:`docs/include/introduction.txt`
  731. After you have changed these files you must render
  732. the :file:`README` files. There's a script to convert sphinx syntax
  733. to generic reStructured Text syntax, and the make target `readme`
  734. does this for you:
  735. .. code-block:: console
  736. $ make readme
  737. Now commit the changes:
  738. .. code-block:: console
  739. $ git commit -a -m "Bumps version to X.Y.Z"
  740. and make a new version tag:
  741. .. code-block:: console
  742. $ git tag vX.Y.Z
  743. $ git push --tags
  744. Releasing
  745. ---------
  746. Commands to make a new public stable release:
  747. .. code-block:: console
  748. $ make distcheck # checks pep8, autodoc index, runs tests and more
  749. $ make dist # NOTE: Runs git clean -xdf and removes files not in the repo.
  750. $ python setup.py sdist upload --sign --identity='Celery Security Team'
  751. $ python setup.py bdist_wheel upload --sign --identity='Celery Security Team'
  752. If this is a new release series then you also need to do the
  753. following:
  754. * Go to the Read The Docs management interface at:
  755. http://readthedocs.org/projects/celery/?fromdocs=celery
  756. * Enter "Edit project"
  757. Change default branch to the branch of this series, for example, use
  758. the ``2.4`` branch for the 2.4 series.
  759. * Also add the previous version under the "versions" tab.