CONTRIBUTING.rst 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125
  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 ``nosetests <nose>``:
  332. ::
  333. $ nosetests
  334. Some useful options to ``nosetests`` are:
  335. * ``-x``
  336. Stop running the tests at the first test that fails.
  337. * ``-s``
  338. Don't capture output
  339. * ``-nologcapture``
  340. Don't capture log output.
  341. * ``-v``
  342. Run with verbose output.
  343. If you want to run the tests for a single test file only
  344. you can do so like this:
  345. ::
  346. $ nosetests celery.tests.test_worker.test_worker_job
  347. .. _contributing-pull-requests:
  348. Creating pull requests
  349. ----------------------
  350. When your feature/bugfix is complete you may want to submit
  351. a pull requests so that it can be reviewed by the maintainers.
  352. Creating pull requests is easy, and also let you track the progress
  353. of your contribution. Read the `Pull Requests`_ section in the GitHub
  354. Guide to learn how this is done.
  355. You can also attach pull requests to existing issues by following
  356. the steps outlined here: http://bit.ly/koJoso
  357. .. _`Pull Requests`: http://help.github.com/send-pull-requests/
  358. .. _contributing-coverage:
  359. Calculating test coverage
  360. ~~~~~~~~~~~~~~~~~~~~~~~~~
  361. To calculate test coverage you must first install the ``coverage`` module.
  362. Installing the ``coverage`` module:
  363. ::
  364. $ pip install -U coverage
  365. Code coverage in HTML:
  366. ::
  367. $ nosetests --with-coverage --cover-html
  368. The coverage output will then be located at
  369. ``celery/tests/cover/index.html``.
  370. Code coverage in XML (Cobertura-style):
  371. ::
  372. $ nosetests --with-coverage --cover-xml --cover-xml-file=coverage.xml
  373. The coverage XML output will then be located at ``coverage.xml``
  374. .. _contributing-tox:
  375. Running the tests on all supported Python versions
  376. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  377. There's a ``tox`` configuration file in the top directory of the
  378. distribution.
  379. To run the tests for all supported Python versions simply execute:
  380. ::
  381. $ tox
  382. Use the ``tox -e`` option if you only want to test specific Python versions:
  383. ::
  384. $ tox -e 2.7
  385. Building the documentation
  386. --------------------------
  387. To build the documentation you need to install the dependencies
  388. listed in ``requirements/docs.txt``:
  389. ::
  390. $ pip install -U -r requirements/docs.txt
  391. After these dependencies are installed you should be able to
  392. build the docs by running:
  393. ::
  394. $ cd docs
  395. $ rm -rf _build
  396. $ make html
  397. Make sure there are no errors or warnings in the build output.
  398. After building succeeds the documentation is available at ``_build/html``.
  399. .. _contributing-verify:
  400. Verifying your contribution
  401. ---------------------------
  402. To use these tools you need to install a few dependencies. These dependencies
  403. can be found in ``requirements/pkgutils.txt``.
  404. Installing the dependencies:
  405. ::
  406. $ pip install -U -r requirements/pkgutils.txt
  407. pyflakes & PEP-8
  408. ~~~~~~~~~~~~~~~~
  409. To ensure that your changes conform to ``8`` and to run pyflakes
  410. execute:
  411. ::
  412. $ make flakecheck
  413. To not return a negative exit code when this command fails use
  414. the ``flakes`` target instead:
  415. ::
  416. $ make flakes§
  417. API reference
  418. ~~~~~~~~~~~~~
  419. To make sure that all modules have a corresponding section in the API
  420. reference please execute:
  421. ::
  422. $ make apicheck
  423. $ make indexcheck
  424. If files are missing you can add them by copying an existing reference file.
  425. If the module is internal it should be part of the internal reference
  426. located in ``docs/internals/reference/``. If the module is public
  427. it should be located in ``docs/reference/``.
  428. For example if reference is missing for the module ``celery.worker.awesome``
  429. and this module is considered part of the public API, use the following steps:
  430. Use an existing file as a template:
  431. ::
  432. $ cd docs/reference/
  433. $ cp celery.schedules.rst celery.worker.awesome.rst
  434. Edit the file using your favorite editor:
  435. ::
  436. $ vim celery.worker.awesome.rst
  437. # change every occurrence of ``celery.schedules`` to
  438. # ``celery.worker.awesome``
  439. Edit the index using your favorite editor:
  440. ::
  441. $ vim index.rst
  442. # Add ``celery.worker.awesome`` to the index.
  443. Commit your changes:
  444. ::
  445. # Add the file to git
  446. $ git add celery.worker.awesome.rst
  447. $ git add index.rst
  448. $ git commit celery.worker.awesome.rst index.rst \
  449. -m "Adds reference for celery.worker.awesome"
  450. .. _coding-style:
  451. Coding Style
  452. ============
  453. You should probably be able to pick up the coding style
  454. from surrounding code, but it is a good idea to be aware of the
  455. following conventions.
  456. * All Python code must follow the ``8`` guidelines.
  457. ``pep8`` is a utility you can use to verify that your code
  458. is following the conventions.
  459. * Docstrings must follow the ``257`` conventions, and use the following
  460. style.
  461. Do this:
  462. ::
  463. def method(self, arg):
  464. """Short description.
  465. More details.
  466. """
  467. or:
  468. ::
  469. def method(self, arg):
  470. """Short description."""
  471. but not this:
  472. ::
  473. def method(self, arg):
  474. """
  475. Short description.
  476. """
  477. * Lines shouldn't 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. This 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 .platforms import Pidfile
  503. from .five import zip_longest, items, range
  504. from .utils.time import maybe_timedelta
  505. * Wild-card 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 isn't) 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 didn't 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 doesn't apply if the package doesn't include
  522. support for Python 2.5)
  523. * Note that we use "new-style` relative imports when the distribution
  524. doesn't 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. For the Cassandra backend this is
  537. ``requirements/extras/cassandra.txt``, and the file looks like this:
  538. ::
  539. pycassa
  540. These are pip requirement files so you can have version specifiers and
  541. multiple packages are separated by newline. A more complex example could
  542. be:
  543. ::
  544. # pycassa 2.0 breaks Foo
  545. pycassa>=1.0,<2.0
  546. thrift
  547. 2) Modify ``setup.py``
  548. After the requirements file is added you need to add it as an option
  549. to ``setup.py`` in the ``extras_require`` section::
  550. extra['extras_require'] = {
  551. # ...
  552. 'cassandra': extras('cassandra.txt'),
  553. }
  554. 3) Document the new feature in ``docs/includes/installation.txt``
  555. You must add your feature to the list in the `bundles`_ section
  556. of ``docs/includes/installation.txt``.
  557. After you've made changes to this file you need to render
  558. the distro ``README`` file:
  559. ::
  560. $ pip install -U requirements/pkgutils.txt
  561. $ make readme
  562. That's all that needs to be done, but remember that if your feature
  563. adds additional configuration options then these needs to be documented
  564. in ``docs/configuration.rst``. Also all settings need to be added to the
  565. ``celery/app/defaults.py`` module.
  566. Result backends require a separate section in the ``docs/configuration.rst``
  567. file.
  568. .. _contact_information:
  569. Contacts
  570. ========
  571. This is a list of people that can be contacted for questions
  572. regarding the official git repositories, PyPI packages
  573. Read the Docs pages.
  574. If the issue isn't an emergency then it's better
  575. to `report an issue`_.
  576. Committers
  577. ----------
  578. Ask Solem
  579. ~~~~~~~~~
  580. :github: https://github.com/ask
  581. :twitter: http://twitter.com/#!/asksol
  582. Dmitry Malinovsky
  583. ~~~~~~~~~~~~~~~~~
  584. :github: https://github.com/malinoff
  585. :twitter: https://twitter.com/__malinoff__
  586. Ionel Cristian Mărieș
  587. ~~~~~~~~~~~~~~~~~~~~~
  588. :github: https://github.com/ionelmc
  589. :twitter: https://twitter.com/ionelmc
  590. Mher Movsisyan
  591. ~~~~~~~~~~~~~~
  592. :github: https://github.com/mher
  593. :twitter: http://twitter.com/#!/movsm
  594. Omer Katz
  595. ~~~~~~~~~
  596. :github: https://github.com/thedrow
  597. :twitter: https://twitter.com/the_drow
  598. Steeve Morin
  599. ~~~~~~~~~~~~
  600. :github: https://github.com/steeve
  601. :twitter: http://twitter.com/#!/steeve
  602. Website
  603. -------
  604. The Celery Project website is run and maintained by
  605. Mauro Rocco
  606. ~~~~~~~~~~~
  607. :github: https://github.com/fireantology
  608. :twitter: https://twitter.com/#!/fireantology
  609. with design by:
  610. Jan Henrik Helmers
  611. ~~~~~~~~~~~~~~~~~~
  612. :web: http://www.helmersworks.com
  613. :twitter: http://twitter.com/#!/helmers
  614. .. _packages:
  615. Packages
  616. ========
  617. ``celery``
  618. ----------
  619. :git: https://github.com/celery/celery
  620. :CI: http://travis-ci.org/#!/celery/celery
  621. :Windows-CI: https://ci.appveyor.com/project/ask/celery
  622. :PyPI: ``celery``
  623. :docs: http://docs.celeryproject.org
  624. ``kombu``
  625. ---------
  626. Messaging library.
  627. :git: https://github.com/celery/kombu
  628. :CI: http://travis-ci.org/#!/celery/kombu
  629. :Windows-CI: https://ci.appveyor.com/project/ask/kombu
  630. :PyPI: ``kombu``
  631. :docs: https://kombu.readthedocs.io
  632. ``amqp``
  633. --------
  634. Python AMQP 0.9.1 client.
  635. :git: https://github.com/celery/py-amqp
  636. :CI: http://travis-ci.org/#!/celery/py-amqp
  637. :Windows-CI: https://ci.appveyor.com/project/ask/py-amqp
  638. :PyPI: ``amqp``
  639. :docs: https://amqp.readthedocs.io
  640. ``vine``
  641. --------
  642. Promise/deferred implementation.
  643. :git: https://github.com/celery/vine/
  644. :CI: http://travis-ci.org/#!/celery/vine/
  645. :Windows-CI: https://ci.appveyor.com/project/ask/vine
  646. :PyPI: ``vine``
  647. :docs: https://vine.readthedocs.io
  648. ``billiard``
  649. ------------
  650. Fork of multiprocessing containing improvements
  651. that'll eventually be merged into the Python stdlib.
  652. :git: https://github.com/celery/billiard
  653. :CI: http://travis-ci.org/#!/celery/billiard/
  654. :Windows-CI: https://ci.appveyor.com/project/ask/billiard
  655. :PyPI: ``billiard``
  656. ``django-celery-beat``
  657. ----------------------
  658. Database-backed Periodic Tasks with admin interface using the Django ORM.
  659. :git: https://github.com/celery/django-celery-beat
  660. :CI: http://travis-ci.org/#!/celery/django-celery-beat
  661. :Windows-CI: https://ci.appveyor.com/project/ask/django-celery-beat
  662. :PyPI: ``django-celery-beat``
  663. ``django-celery-results``
  664. -------------------------
  665. Store task results in the Django ORM, or using the Django Cache Framework.
  666. :git: https://github.com/celery/django-celery-results
  667. :CI: http://travis-ci.org/#!/celery/django-celery-results
  668. :Windows-CI: https://ci.appveyor.com/project/ask/django-celery-results
  669. :PyPI: ``django-celery-results``
  670. ``librabbitmq``
  671. ---------------
  672. Very fast Python AMQP client written in C.
  673. :git: https://github.com/celery/librabbitmq
  674. :PyPI: ``librabbitmq``
  675. ``cell``
  676. --------
  677. Actor library.
  678. :git: https://github.com/celery/cell
  679. :PyPI: ``cell``
  680. ``cyme``
  681. --------
  682. Distributed Celery Instance manager.
  683. :git: https://github.com/celery/cyme
  684. :PyPI: ``cyme``
  685. :docs: https://cyme.readthedocs.io/
  686. Deprecated
  687. ----------
  688. - ``django-celery``
  689. :git: https://github.com/celery/django-celery
  690. :PyPI: ``django-celery``
  691. :docs: http://docs.celeryproject.org/en/latest/django
  692. - ``Flask-Celery``
  693. :git: https://github.com/ask/Flask-Celery
  694. :PyPI: ``Flask-Celery``
  695. - ``celerymon``
  696. :git: https://github.com/celery/celerymon
  697. :PyPI: ``celerymon``
  698. - ``carrot``
  699. :git: https://github.com/ask/carrot
  700. :PyPI: ``carrot``
  701. - ``ghettoq``
  702. :git: https://github.com/ask/ghettoq
  703. :PyPI: ``ghettoq``
  704. - ``kombu-sqlalchemy``
  705. :git: https://github.com/ask/kombu-sqlalchemy
  706. :PyPI: ``kombu-sqlalchemy``
  707. - ``django-kombu``
  708. :git: https://github.com/ask/django-kombu
  709. :PyPI: ``django-kombu``
  710. - ``pylibrabbitmq``
  711. Old name for ``librabbitmq``.
  712. :git: ``None``
  713. :PyPI: ``pylibrabbitmq``
  714. .. _release-procedure:
  715. Release Procedure
  716. =================
  717. Updating the version number
  718. ---------------------------
  719. The version number must be updated two places:
  720. * ``celery/__init__.py``
  721. * ``docs/include/introduction.txt``
  722. After you have changed these files you must render
  723. the ``README`` files. There's a script to convert sphinx syntax
  724. to generic reStructured Text syntax, and the make target `readme`
  725. does this for you:
  726. ::
  727. $ make readme
  728. Now commit the changes:
  729. ::
  730. $ git commit -a -m "Bumps version to X.Y.Z"
  731. and make a new version tag:
  732. ::
  733. $ git tag vX.Y.Z
  734. $ git push --tags
  735. Releasing
  736. ---------
  737. Commands to make a new public stable release:
  738. ::
  739. $ make distcheck # checks pep8, autodoc index, runs tests and more
  740. $ make dist # NOTE: Runs git clean -xdf and removes files not in the repo.
  741. $ python setup.py sdist upload --sign --identity='Celery Security Team'
  742. $ python setup.py bdist_wheel upload --sign --identity='Celery Security Team'
  743. If this is a new release series then you also need to do the
  744. following:
  745. * Go to the Read The Docs management interface at:
  746. http://readthedocs.org/projects/celery/?fromdocs=celery
  747. * Enter "Edit project"
  748. Change default branch to the branch of this series, for example, use
  749. the ``2.4`` branch for the 2.4 series.
  750. * Also add the previous version under the "versions" tab.
  751. .. _`mailing-list`: http://groups.google.com/group/celery-users
  752. .. _`irc-channel`: http://docs.celeryproject.org/en/latest/getting-started/resources.html#irc
  753. .. _`internals-guide`: http://docs.celeryproject.org/en/latest/internals/guide.html
  754. .. _`bundles`: http://docs.celeryproject.org/en/latest/getting-started/introduction.html#bundles
  755. .. _`report an issue`: http://docs.celeryproject.org/en/latest/contributing.html#reporting-bugs