@@ -160,6 +160,300 @@ issue tracker.
160
160
If you are unsure of the origin of the bug you can ask the
161
161
:ref: `mailing-list `, or just use the Celery issue tracker.
162
162
163
+ .. _versions ::
164
+
165
+ Versions
166
+ ========
167
+
168
+ Version numbers consists of a major version, minor version and a release number.
169
+ Since version 2.1.0 we use the versioning semantics described by
170
+ semver: http://semver.org.
171
+
172
+ Stable releases are published at PyPI
173
+ while development releases are only available in the GitHub git repository as tags.
174
+ All version tags starts with “v”, so version 0.8.0 is the tag v0.8.0.
175
+
176
+ .. _git-branches :
177
+
178
+ Branches
179
+ ========
180
+
181
+ Current active version branches:
182
+
183
+ * master (http://github.com/ask/celery/tree/master)
184
+ * 3.0-devel (http://github.com/ask/celery/tree/3.0-devel)
185
+
186
+ You can see the state of any branch by looking at the Changelog:
187
+
188
+ https://github.com/ask/celery/blob/master/Changelog
189
+
190
+ If the branch is in active development the topmost version info should
191
+ contain metadata like::
192
+
193
+ 2.4.0
194
+ ======
195
+ :release-date: TBA
196
+ :status: DEVELOPMENT
197
+ :branch: master
198
+
199
+ The ``status `` field can be one of:
200
+
201
+ * ``PLANNING ``
202
+
203
+ The branch is currently experimental and in the planning stage.
204
+
205
+ * ``DEVELOPMENT ``
206
+
207
+ The branch is in active development, but the test suite should
208
+ be passing and the product should be working and possible for users to test.
209
+
210
+ * ``FROZEN ``
211
+
212
+ The branch is frozen, and no more features will be accepted.
213
+ When a branch is frozen the focus is on testing the version as much
214
+ as possible before it is released.
215
+
216
+ ``master `` branch
217
+ -----------------
218
+
219
+ The master branch is where development of the next version happens.
220
+
221
+ Maintenance branches
222
+ --------------------
223
+
224
+ Maintenance branches are named after the version, e.g. the maintenance branch
225
+ for the 2.2.x series is named ``2.2 ``. Previously these were named
226
+ ``releaseXX-maint ``.
227
+
228
+ The versions we currently maintain is:
229
+
230
+ * 2.3
231
+
232
+ This is the current series.
233
+
234
+ * 2.2
235
+
236
+ This is the previous series, and the last version to support Python 2.4.
237
+
238
+ * 2.1
239
+
240
+ This is the last version to use the ``carrot `` AMQP framework.
241
+ Recent versions use ``kombu ``.
242
+
243
+ Archived branches
244
+ -----------------
245
+
246
+ Archived branches are kept for preserving history only,
247
+ and theoretically someone could provide patches for these if they depend
248
+ on a series that is no longer officially supported.
249
+
250
+ An archived version is named ``X.Y-archived ``.
251
+
252
+ Our currently archived branches are:
253
+
254
+ * 2.1-archived
255
+
256
+ * 2.0-archived
257
+
258
+ * 1.0-archived
259
+
260
+ Feature branches
261
+ ----------------
262
+
263
+ Major new features are worked on in dedicated branches.
264
+ There is no strict naming requirement for these branches.
265
+
266
+ Feature branches are removed once they have been merged into a release branch.
267
+
268
+ Tags
269
+ ====
270
+
271
+ Tags are used exclusively for tagging releases. A release tag is
272
+ named with the format ``vX.Y.Z ``, e.g. ``v2.3.1 ``.
273
+ Experimental releases contain an additional identifier ``vX.Y.Z-id ``, e.g.
274
+ ``v3.0.0-rc1 ``. Experimental tags may be removed after the official release.
275
+
276
+ .. _contributing-changes :
277
+
278
+ Working on Features & Patches
279
+ =============================
280
+
281
+ Forking and Setting up the Repository
282
+ -------------------------------------
283
+
284
+ First you need to fork the Celery repository, a good introduction to this
285
+ is in the Github Guide: `Fork a Repo `_.
286
+
287
+ After you have cloned the repository you should checkout your copy
288
+ to a directory on your machine::
289
+
290
+ $ git clone git@github.com:username/celery.git
291
+
292
+ When the repository is cloned enter the directory to set up easy access
293
+ to upstream changes::
294
+
295
+ $ cd celery
296
+ $ git remote add upstream git://github.com/ask/celery.git
297
+ $ git fetch upstream
298
+
299
+ If you need to pull in new changes from upstream you should
300
+ always use the :option: `--rebase ` option to ``git pull ``::
301
+
302
+ git pull --rebase upstream master
303
+
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
+
309
+ If you need to work on a different branch than ``master `` you can
310
+ fetch and checkout a remote branch like this::
311
+
312
+ git checkout --track -b 3.0-devel origin/3.0-devel
313
+
314
+ For a list of branches see :ref: `git-branches `.
315
+
316
+ .. _`Fork a Repo` : http://help.github.com/fork-a-repo/
317
+ .. _`Rebasing merge commits in git` :
318
+ http://notes.envato.com/developers/rebasing-merge-commits-in-git/
319
+ .. _`Rebase` : http://help.github.com/rebase/
320
+
321
+ .. _contributing-testing :
322
+
323
+ Running the Unit Test Suite
324
+ ---------------------------
325
+
326
+ To run the Celery test suite you need to install a few dependencies.
327
+ A complete list of the dependencies needed are located in
328
+ :file: `requirements/test.txt `.
329
+
330
+ Installing the test requirements::
331
+
332
+ $ pip -E $VIRTUAL_ENV install -U -r requirements/test.txt
333
+
334
+ When installation of dependencies is complete you can execute
335
+ the test suite by calling ``nosetests ``::
336
+
337
+ $ nosetests
338
+
339
+ Some useful options to :program: `nosetests ` are:
340
+
341
+ * :option: `-x `
342
+
343
+ Stop running the tests at the first test that fails.
344
+
345
+ * :option: `-s `
346
+
347
+ Don't capture output
348
+
349
+ * :option: `--nologcapture `
350
+
351
+ Don't capture log output.
352
+
353
+ * :option: `-v `
354
+
355
+ Run with verbose output.
356
+
357
+ If you want to run the tests for a single test file only
358
+ you can do so like this::
359
+
360
+ $ nosetests celery.tests.test_worker.test_worker_job
361
+
362
+ .. _contributing-coverage :
363
+
364
+ Calculating code coverage
365
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
366
+
367
+ Code coverage in HTML::
368
+
369
+ $ nosetests --with-coverage3 --cover3-html
370
+
371
+ The coverage output will then be located at
372
+ :file: `celery/tests/cover/index.html `.
373
+
374
+ Code coverage in XML (Cobertura-style)::
375
+
376
+ $ nosetests --with-coverage3 --cover3-xml --cover3-xml-file=coverage.xml
377
+
378
+ The coverage XML output will then be located at :file: `coverage.xml `
379
+
380
+ .. _contributing-tox :
381
+
382
+ Running the tests on all supported Python versions
383
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
384
+
385
+ There is a ``tox `` configuration file in the top directory of the
386
+ distribution.
387
+
388
+ To run the tests for all supported Python versions simply execute::
389
+
390
+ $ tox
391
+
392
+ If you only want to test specific Python versions use the :option: `-e `
393
+ option::
394
+
395
+ $ tox -e py25,py26
396
+
397
+ .. _contributing-verify :
398
+
399
+ Verifying your contribution
400
+ ---------------------------
401
+
402
+ To use these tools you need to install a few dependencies. These dependencies
403
+ can be found in :file: `requirements/pkgutils.txt `.
404
+
405
+ Installing the dependencies::
406
+
407
+ $ pip -E $VIRTUAL_ENV install -U -r requirements/pkgutils.txt
408
+
409
+ pyflakes & PEP8
410
+ ~~~~~~~~~~~~~~~
411
+
412
+ To ensure that your changes conform to PEP8 and to run pyflakes
413
+ execute::
414
+
415
+ $ paver flake8
416
+
417
+ To not return a negative exit code when this command fails use the
418
+ :option: `-E ` option, this can be convenient while developing::
419
+
420
+ $ paver flake8 -E
421
+
422
+ API reference
423
+ ~~~~~~~~~~~~~
424
+
425
+ To make sure that all modules have a corresponding section in the API
426
+ reference please execute::
427
+
428
+ $ paver autodoc
429
+ $ paver verifyindex
430
+
431
+ If files are missing you can add them by copying an existing reference file.
432
+
433
+ If the module is internal it should be part of the internal reference
434
+ located in :file: `docs/internals/reference/ `. If the module is public
435
+ it should be located in :file: `docs/reference/ `.
436
+
437
+ For example if reference is missing for the module ``celery.worker.awesome ``
438
+ and this module is considered part of the public API, use the following steps::
439
+
440
+ $ cd docs/reference/
441
+ $ cp celery.schedules.rst celery.worker.awesome.rst
442
+ $ vim celery.worker.awesome.rst
443
+
444
+ # change every occurance of ``celery.schedules`` to
445
+ # ``celery.worker.awesome``
446
+
447
+ $ vim index.rst
448
+
449
+ # Add ``celery.worker.awesome`` to the index.
450
+
451
+ # Add the file to git
452
+ $ git add celery.worker.awesome.rst
453
+ $ git add index.rst
454
+ $ git commit celery.worker.awesome.rst index.rst \
455
+ -m "Adds reference for celery.worker.awesome"
456
+
163
457
.. _coding-style :
164
458
165
459
Coding Style
@@ -212,6 +506,16 @@ is following the conventions.
212
506
213
507
* Lines should not exceed 78 columns.
214
508
509
+ You can enforce this in :program: `vim ` by setting the ``textwidth `` option::
510
+
511
+ .. code-block :: vim
512
+
513
+ set textwidth=78
514
+
515
+ If adhering to this limit makes the code less readable, you have one more
516
+ character to go on, which means 78 is a soft limit, and 79 is the hard
517
+ limit :)
518
+
215
519
* Import order
216
520
217
521
* Python standard library (`import xxx `)
@@ -227,7 +531,7 @@ is following the conventions.
227
531
* Django packages.
228
532
* Other modules from the current package.
229
533
230
- Within these sections imports should be sorted by name.
534
+ Within these sections the imports should be sorted by module name.
231
535
232
536
Example:
233
537
@@ -239,8 +543,68 @@ is following the conventions.
239
543
from collections import deque
240
544
from Queue import Queue, Empty
241
545
242
- from celery .datastructures import TokenBucket
243
- from celery .utils import timeutils
244
- from celery .utils.compat import all , izip_longest, chain_from_iterable
546
+ from .datastructures import TokenBucket
547
+ from .utils import timeutils
548
+ from .utils.compat import all , izip_longest, chain_from_iterable
245
549
246
550
* Wildcard imports must not be used (`from xxx import * `).
551
+
552
+ * For distributions where Python 2.5 is the oldest support version
553
+ additional rules apply:
554
+
555
+ * Absolute imports must be enabled at the top of every module::
556
+
557
+ from __future__ import absolute_import
558
+
559
+ * If the module uses the with statement it must also enable that::
560
+
561
+ from __future__ import with_statement
562
+
563
+ * Every future import must be on its own line, as older Python 2.5
564
+ releases did not support importing multiple features on the
565
+ same future import line::
566
+
567
+ # Good
568
+ from __future__ import absolute_import
569
+ from __future__ import with_statement
570
+
571
+ # Bad
572
+ from __future__ import absolute_import, with_statement
573
+
574
+ (Note that this rule does not apply if the package does not include
575
+ support for Python 2.5)
576
+
577
+
578
+ * Note that we use "new-style` relative imports when the distribution
579
+ does not support Python versions below 2.5
580
+
581
+ .. code-block :: python
582
+
583
+ from . import submodule
584
+
585
+ .. _release-procedure :
586
+
587
+ Release Procedure
588
+ =================
589
+
590
+ Commands to make a new public stable release::
591
+
592
+ $ paver releaseok # checks pep8, autodoc index and runs tests
593
+ $ paver removepyc # Remove .pyc files.
594
+ $ git clean -xdn # Check that there's no left-over files in the repository.
595
+ $ python2.5 setup.py sdist upload # Upload package to PyPI
596
+ $ paver upload_pypi_docs
597
+ $ paver ghdocs # Build and upload documentation to Github.
598
+
599
+ If this is a new release series then you also need to do the
600
+ following:
601
+
602
+ * Go to the Read The Docs management interface at:
603
+ http://readthedocs.org/projects/celery/?fromdocs=celery
604
+
605
+ * Enter "Edit project"
606
+
607
+ Change default branch to the branch of this series, e.g. ``2.4 ``
608
+ for series 2.4.
609
+
610
+ * Also add the previous version under the "versions" tab.
0 commit comments