CONTRIBUTING.rst 31 KB

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