CONTRIBUTING.rst 30 KB

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