| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908 | .. _contributing:============== Contributing==============.. contents::    :local:.. _community-code-of-conduct:Community Code of Conduct=========================The goal is to maintain a diverse community that is pleasant for everyone.That is why we would greatly appreciate it if everyone contributing to andinteracting with the community also followed this Code of Conduct.The Code of Conduct covers our behavior as members of the community,in any forum, mailing list, wiki, website, Internet relay chat (IRC), publicmeeting or private correspondence.The Code of Conduct is heavily based on the `Ubuntu Code of Conduct`_, andthe `Pylons Code of Conduct`_... _`Ubuntu Code of Conduct`: http://www.ubuntu.com/community/conduct.. _`Pylons Code of Conduct`: http://docs.pylonshq.com/community/conduct.htmlBe considerate.---------------Your work will be used by other people, and you in turn will depend on thework of others.  Any decision you take will affect users and colleagues, andwe expect you to take those consequences into account when making decisions.Even if it's not obvious at the time, our contributions to Ubuntu will impactthe work of others.  For example, changes to code, infrastructure, policy,documentation and translations during a release may negatively impactothers work.Be respectful.--------------The Celery community and its members treat one another with respect.  Everyonecan make a valuable contribution to Celery.  We may not always agree, butdisagreement is no excuse for poor behavior and poor manners.  We might allexperience some frustration now and then, but we cannot allow that frustrationto turn into a personal attack.  It's important to remember that a communitywhere people feel uncomfortable or threatened is not a productive one.  Weexpect members of the Celery community to be respectful when dealing withother contributors as well as with people outside the Celery project and withusers of Celery.Be collaborative.-----------------Collaboration is central to Celery and to the larger free software community.We should always be open to collaboration.  Your work should be donetransparently and patches from Celery should be given back to the communitywhen they are made, not just when the distribution releases.  If you wishto work on new code for existing upstream projects, at least keep thoseprojects informed of your ideas and progress.  It many not be possible toget consensus from upstream, or even from your colleagues about the correctimplementation for an idea, so don't feel obliged to have that agreementbefore you begin, but at least keep the outside world informed of your work,and publish your work in a way that allows outsiders to test, discuss andcontribute to your efforts.When you disagree, consult others.----------------------------------Disagreements, both political and technical, happen all the time andthe Celery community is no exception.  It is important that we resolvedisagreements and differing views constructively and with the help of thecommunity and community process.  If you really want to go a differentway, then we encourage you to make a derivative distribution or alternateset of packages that still build on the work we've done to utilize as commonof a core as possible.When you are unsure, ask for help.----------------------------------Nobody knows everything, and nobody is expected to be perfect.  Askingquestions avoids many problems down the road, and so questions areencouraged.  Those who are asked questions should be responsive and helpful.However, when asking a question, care must be taken to do so in an appropriateforum.Step down considerately.------------------------Developers on every project come and go and Celery is no different.  When youleave or disengage from the project, in whole or in part, we ask that you doso in a way that minimizes disruption to the project.  This means you shouldtell people you are leaving and take the proper steps to ensure that otherscan pick up where you leave off... _reporting-bugs:Reporting a Bug===============Bugs can always be described to the :ref:`mailing-list`, but the bestway to report an issue and to ensure a timely response is to use theissue tracker.1) Create a GitHub account.You need to `create a GitHub account`_ to be able to create new issuesand participate in the discussion... _`create a GitHub account`: https://github.com/signup/free2) Determine if your bug is really a bug.You should not file a bug if you are requesting support.  For that you can usethe :ref:`mailing-list`, or :ref:`irc-channel`.3) Make sure your bug hasn't already been reported.Search through the appropriate Issue tracker.  If a bug like yours was found,check if you have new information that could be reported to helpthe developers fix the bug.4) Collect information about the bug.To have the best chance of having a bug fixed, we need to be able to easilyreproduce the conditions that caused it.  Most of the time this informationwill be from a Python traceback message, though some bugs might be in design,spelling or other errors on the website/docs/code.If the error is from a Python traceback, include it in the bug report.We also need to know what platform you're running (Windows, OSX, Linux, etc),the version of your Python interpreter, and the version of Celery, and relatedpackages that you were running when the bug occurred.5) Submit the bug.By default `GitHub`_ will email you to let you know when new comments havebeen made on your bug. In the event you've turned this feature off, youshould check back on occasion to ensure you don't miss any questions adeveloper trying to fix the bug might ask... _`GitHub`: http://github.com.. _issue-trackers:Issue Trackers--------------Bugs for a package in the Celery ecosystem should be reported to the relevantissue tracker.* Celery: http://github.com/celery/celery/issues/* Django-Celery: http://github.com/celery/django-celery/issues* Celery-Pylons: http://bitbucket.org/ianschenck/celery-pylons/issues* Kombu: http://github.com/celery/kombu/issuesIf you are unsure of the origin of the bug you can ask the:ref:`mailing-list`, or just use the Celery issue tracker.Contributors guide to the codebase==================================There's a seperate section for internal details,including details about the codebase and a style guide.Read :ref:`internals-guide` for more!.. _versions:Versions========Version numbers consists of a major version, minor version and a release number.Since version 2.1.0 we use the versioning semantics described bysemver: http://semver.org.Stable releases are published at PyPIwhile development releases are only available in the GitHub git repository as tags.All version tags starts with “v”, so version 0.8.0 is the tag v0.8.0... _git-branches:Branches========Current active version branches:* master (http://github.com/celery/celery/tree/master)* 3.0 (http://github.com/celery/celery/tree/3.0)You can see the state of any branch by looking at the Changelog:    https://github.com/celery/celery/blob/master/ChangelogIf the branch is in active development the topmost version info shouldcontain metadata like::    2.4.0    ======    :release-date: TBA    :status: DEVELOPMENT    :branch: masterThe ``status`` field can be one of:* ``PLANNING``    The branch is currently experimental and in the planning stage.* ``DEVELOPMENT``    The branch is in active development, but the test suite should    be passing and the product should be working and possible for users to test.* ``FROZEN``    The branch is frozen, and no more features will be accepted.    When a branch is frozen the focus is on testing the version as much    as possible before it is released.``master`` branch-----------------The master branch is where development of the next version happens.Maintenance branches--------------------Maintenance branches are named after the version, e.g. the maintenance branchfor the 2.2.x series is named ``2.2``.  Previously these were named``releaseXX-maint``.The versions we currently maintain is:* 2.3  This is the current series.* 2.2  This is the previous series, and the last version to support Python 2.4.* 2.1  This is the last version to use the ``carrot`` AMQP framework.  Recent versions use ``kombu``.Archived branches-----------------Archived branches are kept for preserving history only,and theoretically someone could provide patches for these if they dependon a series that is no longer officially supported.An archived version is named ``X.Y-archived``.Our currently archived branches are:* 2.1-archived* 2.0-archived* 1.0-archivedFeature branches----------------Major new features are worked on in dedicated branches.There is no strict naming requirement for these branches.Feature branches are removed once they have been merged into a release branch.Tags====Tags are used exclusively for tagging releases.  A release tag isnamed with the format ``vX.Y.Z``, e.g. ``v2.3.1``.Experimental releases contain an additional identifier ``vX.Y.Z-id``, e.g.``v3.0.0-rc1``.  Experimental tags may be removed after the official release... _contributing-changes:Working on Features & Patches=============================.. note::    Contributing to Celery should be as simple as possible,    so none of these steps should be considered mandatory.    You can even send in patches by email if that is your preferred    work method. We won't like you any less, any contribution you make    is always appreciated!    However following these steps may make maintainers life easier,    and may mean that your changes will be accepted sooner.Forking and setting up the repository-------------------------------------First you need to fork the Celery repository, a good introduction to thisis in the Github Guide: `Fork a Repo`_.After you have cloned the repository you should checkout your copyto a directory on your machine:.. code-block:: bash    $ git clone git@github.com:username/celery.gitWhen the repository is cloned enter the directory to set up easy accessto upstream changes:.. code-block:: bash    $ cd celery.. code-block:: bash    $ git remote add upstream git://github.com/celery/celery.git.. code-block:: bash    $ git fetch upstreamIf you need to pull in new changes from upstream you shouldalways use the :option:`--rebase` option to ``git pull``:.. code-block:: bash    git pull --rebase upstream masterWith this option you don't clutter the history with mergingcommit notes. See `Rebasing merge commits in git`_.If you want to learn more about rebasing see the `Rebase`_section in the Github guides.If you need to work on a different branch than ``master`` you canfetch and checkout a remote branch like this::    git checkout --track -b 3.0-devel origin/3.0-develFor a list of branches see :ref:`git-branches`... _`Fork a Repo`: http://help.github.com/fork-a-repo/.. _`Rebasing merge commits in git`:    http://notes.envato.com/developers/rebasing-merge-commits-in-git/.. _`Rebase`: http://help.github.com/rebase/.. _contributing-testing:Running the unit test suite---------------------------To run the Celery test suite you need to install a few dependencies.A complete list of the dependencies needed are located in:file:`requirements/test.txt`.Installing the test requirements:.. code-block:: bash    $ pip install -U -r requirements/test.txtWhen installation of dependencies is complete you can executethe test suite by calling ``nosetests``:.. code-block:: bash    $ nosetestsSome useful options to :program:`nosetests` are:* :option:`-x`    Stop running the tests at the first test that fails.* :option:`-s`    Don't capture output* :option:`--nologcapture`    Don't capture log output.* :option:`-v`    Run with verbose output.If you want to run the tests for a single test file onlyyou can do so like this:.. code-block:: bash    $ nosetests celery.tests.test_worker.test_worker_job.. _contributing-pull-requests:Creating pull requests----------------------When your feature/bugfix is complete you may want to submita pull requests so that it can be reviewed by the maintainers.Creating pull requests is easy, and also let you track the progressof your contribution.  Read the `Pull Requests`_ section in the GithubGuide to learn how this is done.You can also attach pull requests to existing issues by followingthe steps outlined here: http://bit.ly/koJoso.. _`Pull Requests`: http://help.github.com/send-pull-requests/.. _contributing-coverage:Calculating test coverage~~~~~~~~~~~~~~~~~~~~~~~~~Code coverage in HTML:.. code-block:: bash    $ nosetests --with-coverage3 --cover3-htmlThe coverage output will then be located at:file:`celery/tests/cover/index.html`.Code coverage in XML (Cobertura-style):.. code-block:: bash    $ nosetests --with-coverage3 --cover3-xml --cover3-xml-file=coverage.xmlThe coverage XML output will then be located at :file:`coverage.xml`.. _contributing-tox:Running the tests on all supported Python versions~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~There is a ``tox`` configuration file in the top directory of thedistribution.To run the tests for all supported Python versions simply execute:.. code-block:: bash    $ toxIf you only want to test specific Python versions use the :option:`-e`option:.. code-block:: bash    $ tox -e py26Building the documentation--------------------------To build the documentation you need to install the dependencieslisted in :file:`requirements/docs.txt`:.. code-block:: bash    $ pip install -U -r requirements/docs.txtAfter these dependencies are installed you should be able tobuild the docs by running:.. code-block:: bash    $ cd docs    $ rm -rf .build    $ make htmlMake sure there are no errors or warnings in the build output.After building succeeds the documentation is available at :file:`.build/html`... _contributing-verify:Verifying your contribution---------------------------To use these tools you need to install a few dependencies.  These dependenciescan be found in :file:`requirements/pkgutils.txt`.Installing the dependencies:.. code-block:: bash    $ pip install -U -r requirements/pkgutils.txtpyflakes & PEP8~~~~~~~~~~~~~~~To ensure that your changes conform to PEP8 and to run pyflakesexecute:.. code-block:: bash    $ paver flake8To not return a negative exit code when this command fails use the:option:`-E` option, this can be convenient while developing:.. code-block:: bash    $ paver flake8 -EAPI reference~~~~~~~~~~~~~To make sure that all modules have a corresponding section in the APIreference please execute:.. code-block:: bash    $ paver autodoc    $ paver verifyindexIf files are missing you can add them by copying an existing reference file.If the module is internal it should be part of the internal referencelocated in :file:`docs/internals/reference/`.  If the module is publicit should be located in :file:`docs/reference/`.For example if reference is missing for the module ``celery.worker.awesome``and this module is considered part of the public API, use the following steps:.. code-block:: bash    $ cd docs/reference/    $ cp celery.schedules.rst celery.worker.awesome.rst.. code-block:: bash    $ vim celery.worker.awesome.rst        # change every occurance of ``celery.schedules`` to        # ``celery.worker.awesome``.. code-block:: bash    $ vim index.rst        # Add ``celery.worker.awesome`` to the index... code-block:: bash    # Add the file to git    $ git add celery.worker.awesome.rst    $ git add index.rst    $ git commit celery.worker.awesome.rst index.rst \        -m "Adds reference for celery.worker.awesome".. _coding-style:Coding Style============You should probably be able to pick up the coding stylefrom surrounding code, but it is a good idea to be aware of thefollowing conventions.* All Python code must follow the `PEP-8`_ guidelines.`pep8.py`_ is an utility you can use to verify that your codeis following the conventions... _`PEP-8`: http://www.python.org/dev/peps/pep-0008/.. _`pep8.py`: http://pypi.python.org/pypi/pep8* Docstrings must follow the `PEP-257`_ conventions, and use the following  style.    Do this:    .. code-block:: python        def method(self, arg):            """Short description.            More details.            """    or:    .. code-block:: python        def method(self, arg):            """Short description."""    but not this:    .. code-block:: python        def method(self, arg):            """            Short description.            """.. _`PEP-257`: http://www.python.org/dev/peps/pep-0257/* Lines should not exceed 78 columns.  You can enforce this in :program:`vim` by setting the ``textwidth`` option:  .. code-block:: vim        set textwidth=78  If adhering to this limit makes the code less readable, you have one more  character to go on, which means 78 is a soft limit, and 79 is the hard  limit :)* Import order    * Python standard library (`import xxx`)    * Python standard library ('from xxx import`)    * Third party packages.    * Other modules from the current package.    or in case of code using Django:    * Python standard library (`import xxx`)    * Python standard library ('from xxx import`)    * Third party packages.    * Django packages.    * Other modules from the current package.    Within these sections the imports should be sorted by module name.    Example:    .. code-block:: python        import threading        import time        from collections import deque        from Queue import Queue, Empty        from .datastructures import TokenBucket        from .utils import timeutils        from .utils.compat import all, izip_longest, chain_from_iterable* Wildcard imports must not be used (`from xxx import *`).* For distributions where Python 2.5 is the oldest support version  additional rules apply:    * Absolute imports must be enabled at the top of every module::        from __future__ import absolute_import    * If the module uses the with statement and must be compatible      with Python 2.5 (celery is not) then it must also enable that::        from __future__ import with_statement    * Every future import must be on its own line, as older Python 2.5      releases did not support importing multiple features on the      same future import line::        # Good        from __future__ import absolute_import        from __future__ import with_statement        # Bad        from __future__ import absolute_import, with_statement     (Note that this rule does not apply if the package does not include     support for Python 2.5)* Note that we use "new-style` relative imports when the distribution  does not support Python versions below 2.5.. code-block:: python        from . import submodule.. _contact_information:Contacts========This is a list of people that can be contacted for questionsregarding the official git repositories, PyPI packagesRead the Docs pages.If the issue is not an emergency then it is betterto :ref:`report an issue <reporting-bugs>`.Committers----------Ask Solem~~~~~~~~~:github: https://github.com/ask:twitter: http://twitter.com/#!/asksolMher Movsisyan~~~~~~~~~~~~~~:github: https://github.com/mher:twitter: http://twitter.com/#!/movsmSteeve Morin~~~~~~~~~~~~:github: https://github.com/steeve:twitter: http://twitter.com/#!/steeveWebsite-------The Celery Project website is run and maintained byMauro Rocco~~~~~~~~~~~:github: https://github.com/fireantology:twitter: https://twitter.com/#!/fireantologywith design by:Jan Henrik Helmers~~~~~~~~~~~~~~~~~~:web: http://www.helmersworks.com:twitter: http://twitter.com/#!/helmers.. _packages:Packages========celery------:git: https://github.com/celery/celery:CI: http://travis-ci.org/#!/celery/celery:PyPI: http://pypi.python.org/pypi/celery:docs: http://docs.celeryproject.orgkombu-----Messaging framework.:git: https://github.com/celery/kombu:CI: http://travis-ci.org/#!/celery/kombu:PyPI: http://pypi.python.org/pypi/kombu:docs: http://kombu.readthedocs.orgbilliard--------Fork of multiprocessing containing improvementsthat will eventually be merged into the Python stdlib.:git: https://github.com/celery/billiard:PyPI: http://pypi.python.org/pypi/billiardlibrabbitmq-----------Very fast Python AMQP client written in C.:git: https://github.com/celery/librabbitmq:PyPI: http://pypi.python.org/pypi/librabbitmqcelerymon---------Celery monitor web-service.:git: https://github.com/celery/celerymon:PyPI: http://pypi.python.org/pypi/celerymondjango-celery-------------Django <-> Celery Integration.:git: https://github.com/celery/django-celery:PyPI: http://pypi.python.org/pypi/django-celery:docs: http://docs.celeryproject.org/en/latest/djangocl--Actor framework.:git: https://github.com/celery/cl:PyPI: http://pypi.python.org/pypi/clcyme----Distributed Celery Instance manager.:git: https://github.com/celery/cyme:PyPI: http://pypi.python.org/pypi/cyme:docs: http://cyme.readthedocs.org/Deprecated----------- Flask-Celery:git: https://github.com/ask/Flask-Celery:PyPI: http://pypi.python.org/pypi/Flask-Celery- carrot:git: https://github.com/ask/carrot:PyPI: http://pypi.python.org/pypi/carrot- ghettoq:git: https://github.com/ask/ghettoq:PyPI: http://pypi.python.org/pypi/ghettoq- kombu-sqlalchemy:git: https://github.com/ask/kombu-sqlalchemy:PyPI: http://pypi.python.org/pypi/kombu-sqlalchemy- django-kombu:git: https://github.com/ask/django-kombu:PyPI: http://pypi.python.org/pypi/django-kombu- pylibrabbitmqOld name for :mod:`librabbitmq`.:git: :const:`None`:PyPI: http://pypi.python.org/pypi/pylibrabbitmq.. _release-procedure:Release Procedure=================Updating the version number---------------------------The version number must be updated two places:    * :file:`celery/__init__.py`    * :file:`docs/include/introduction.txt`After you have changed these files you must renderthe :file:`README` files.  There is a script to convert sphinx syntaxto generic reStructured Text syntax, and the paver task `readme`does this for you:.. code-block:: bash    $ paver readmeNow commit the changes:.. code-block:: bash    $ git commit -a -m "Bumps version to X.Y.Z"and make a new version tag:.. code-block:: bash    $ git tag vX.Y.Z    $ git push --tagsReleasing---------Commands to make a new public stable release::    $ paver releaseok  # checks pep8, autodoc index, runs tests and more    $ paver removepyc  # Remove .pyc files    $ git clean -xdn   # Check that there's no left-over files in the repo    $ python setup.py sdist upload  # Upload package to PyPIIf this is a new release series then you also need to do thefollowing:* Go to the Read The Docs management interface at:    http://readthedocs.org/projects/celery/?fromdocs=celery* Enter "Edit project"    Change default branch to the branch of this series, e.g. ``2.4``    for series 2.4.* Also add the previous version under the "versions" tab.
 |