CONTRIBUTING.rst 28 KB

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