howto-release-django.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. =====================
  2. How is Django Formed?
  3. =====================
  4. This document explains how to release Django. If you're unlucky enough to
  5. be driving a release, you should follow these instructions to get the
  6. package out.
  7. **Please, keep these instructions up-to-date if you make changes!** The point
  8. here is to be descriptive, not proscriptive, so feel free to streamline or
  9. otherwise make changes, but **update this document accordingly!**
  10. Overview
  11. ========
  12. There are three types of releases that you might need to make
  13. * Security releases, disclosing and fixing a vulnerability. This'll
  14. generally involve two or three simultaneous releases -- e.g.
  15. 1.5.x, 1.6.x, and, depending on timing, perhaps a 1.7 alpha/beta/rc.
  16. * Regular version releases, either a final release (e.g. 1.5) or a
  17. bugfix update (e.g. 1.5.1).
  18. * Pre-releases, e.g. 1.6 beta or something.
  19. In general the steps are about the same regardless, but there are a few
  20. differences noted. The short version is:
  21. #. If this is a security release, pre-notify the security distribution list
  22. at least one week before the actual release.
  23. #. Proofread (and create if needed) the release notes, looking for
  24. organization, writing errors, deprecation timelines, etc. Draft a blog post
  25. and email announcement.
  26. #. Update version numbers and create the release package(s)!
  27. #. Upload the package(s) to the ``djangoproject.com`` server.
  28. #. Unless this is a pre-release, add the new version(s) to PyPI.
  29. #. Declare the new version in the admin on ``djangoproject.com``.
  30. #. Post the blog entry and send out the email announcements.
  31. #. Update version numbers post-release.
  32. There are a lot of details, so please read on.
  33. Prerequisites
  34. =============
  35. You'll need a few things hooked up to make this work:
  36. * A GPG key. *FIXME: sort out exactly whose keys are acceptable for a
  37. release.*
  38. * Access to Django's record on PyPI.
  39. * Access to the ``djangoproject.com`` server to upload files and trigger a
  40. deploy.
  41. * Access to the admin on ``djangoproject.com`` as a "Site maintainer".
  42. * Access to post to ``django-announce``.
  43. * If this is a security release, access to the pre-notification distribution
  44. list.
  45. If this is your first release, you'll need to coordinate with James and Jacob
  46. to get all these things ready to go.
  47. Pre-release tasks
  48. =================
  49. A few items need to be taken care of before even beginning the release process.
  50. This stuff starts about a week before the release; most of it can be done
  51. any time leading up to the actual release:
  52. #. If this is a security release, send out pre-notification **one week**
  53. before the release. We maintain a list of who gets these pre-notification
  54. emails at *FIXME WHERE?*. This email should be signed by the key you'll use
  55. for the release, and should include patches for each issue being fixed.
  56. #. As the release approaches, watch Trac to make sure no release blockers
  57. are left for the upcoming release.
  58. #. Check with the other committers to make sure they don't have any
  59. un-committed changes for the release.
  60. #. Proofread the release notes, including looking at the online
  61. version to catch any broken links or reST errors, and make sure the
  62. release notes contain the correct date.
  63. #. Double-check that the release notes mention deprecation timelines
  64. for any APIs noted as deprecated, and that they mention any changes
  65. in Python version support.
  66. #. Double-check that the release notes index has a link to the notes
  67. for the new release; this will be in ``docs/releases/index.txt``.
  68. Preparing for release
  69. =====================
  70. Write the announcement blog post for the release. You can enter it into the
  71. admin at any time and mark it as inactive. Here are a few examples: `example
  72. security release announcement`__, `example regular release announcement`__,
  73. `example pre-release announcement`__.
  74. __ https://www.djangoproject.com/weblog/2013/feb/19/security/
  75. __ https://www.djangoproject.com/weblog/2012/mar/23/14/
  76. __ https://www.djangoproject.com/weblog/2012/nov/27/15-beta-1/
  77. Actually rolling the release
  78. ============================
  79. OK, this is the fun part, where we actually push out a release!
  80. #. Check `Jenkins`__ is green for the version(s) you're putting out. You
  81. probably shouldn't issue a release until it's green.
  82. __ http://ci.djangoproject.com
  83. #. A release always begins from a release branch, so you should ``git checkout
  84. stable/<release>`` (e.g. checkout ``stable/1.5.x`` to issue a release in the
  85. 1.5 series) and then ``git pull`` to make sure you're up-to-date.
  86. #. If this is a security release, merge the appropriate patches from
  87. ``django-private``. Rebase these patches as necessary to make each one a
  88. simple commit on the release branch rather than a merge commit. To ensure
  89. this, merge them with the ``--ff-only`` flag; for example, ``git checkout
  90. stable/1.5.x; git merge --ff-only security/1.5.x``, if ``security/1.5.x`` is
  91. a branch in the ``django-private`` repo containing the necessary security
  92. patches for the next release in the 1.5 series. If git refuses to merge with
  93. ``--ff-only``, switch to the security-patch branch and rebase it on the
  94. branch you are about to merge it into (``git checkout security/1.5.x; git
  95. rebase stable/1.5.x``) and then switch back and do the merge. Make sure the
  96. commit message for each security fix explains that the commit is a security
  97. fix and that an announcement will follow (`example security commit`__)
  98. __ https://github.com/django/django/commit/3ef4bbf495cc6c061789132e3d50a8231a89406b
  99. #. Update version numbers for the release. This has to happen in three
  100. places: ``django/__init__.py``, ``docs/conf.py``, and ``setup.py``.
  101. Please see `notes on setting the VERSION tuple`_ below for details
  102. on ``VERSION``. Here's `an example commit updating version numbers`__
  103. __ https://github.com/django/django/commit/18d920ea4839fb54f9d2a5dcb555b6a5666ee469
  104. Make sure the ``download_url`` in ``setup.py`` is the actual URL you'll
  105. use for the new release package, not the redirect URL (some tools can't
  106. properly follow redirects).
  107. #. If this is a pre-release package, update the "Development Status" trove
  108. classifier in ``setup.py`` to reflect this. Otherwise, make sure the
  109. classifier is set to ``Development Status :: 5 - Production/Stable``.
  110. #. Tag the release by running ``git tag -s`` *FIXME actual commands*.
  111. #. ``git push`` your work.
  112. #. Make sure you have an absolutely clean tree by running ``git clean -dfx``.
  113. #. Run ``python setup.py sdist`` to generate the release package. This will
  114. create the release package in a ``dist/`` directory.
  115. #. Generate the MD5 and SHA1 hashes of the release package::
  116. $ md5sum dist/Django-<version>.tar.gz
  117. $ sha1sum dist/Django-<version>.tar.gz
  118. #. Create a "checksums" file containing the hashes and release information.
  119. You can start with `a previous checksums file`__ and replace the
  120. dates, keys, links, and checksums. *FIXME: make a template file.*
  121. __ https://www.djangoproject.com/m/pgp/Django-1.5b1.checksum.txt
  122. #. Sign the checksum file using the release key (``gpg
  123. --clearsign``), then verify the signature (``gpg --verify``). *FIXME:
  124. full, actual commands here*.
  125. If you're issuing multiple releases, repeat these steps for each release.
  126. Making the release(s) available to the public
  127. =============================================
  128. Now you're ready to actually put the release out there. To do this:
  129. #. Upload the release package(s) to the djangoproject server; releases go
  130. in ``/home/www/djangoproject.com/src/media/releases``, under a
  131. directory for the appropriate version number (e.g.
  132. ``/home/www/djangoproject.com/src/media/releases/1.5`` for a ``1.5.x``
  133. release.).
  134. #. Upload the checksum file(s); these go in
  135. ``/home/www/djangoproject.com/src/media/pgp``.
  136. #. Test that the release packages install correctly using ``easy_install``
  137. and ``pip``. Here's one method (which requires `virtualenvwrapper`__)::
  138. $ mktmpenv
  139. $ easy_install https://www.djangoproject.com/download/<version>/tarball/
  140. $ deactivate
  141. $ mktmpenv
  142. $ pip install https://www.djangoproject.com/download/<version>/tarball/
  143. $ deactivate
  144. This just tests that the tarballs are available (i.e. redirects are up) and
  145. that they install correctly, but it'll catch silly mistakes. *FIXME:
  146. buildout too?*
  147. __ https://pypi.python.org/pypi/virtualenvwrapper
  148. #. Ask a few people on IRC to verify the checksums by visiting the checksums
  149. file (e.g. https://www.djangoproject.com/m/pgp/Django-1.5b1.checksum.txt)
  150. and following the instructions in it. For bonus points, they can also unpack
  151. the downloaded release tarball and verify that its contents appear to be
  152. correct (proper version numbers, no stray ``.pyc`` or other undesirable
  153. files).
  154. #. If this is a security or regular release, register the new package with PyPI
  155. by uploading the ``PGK-INFO`` file generated in the release package. This
  156. file's *in* the distribution tarball, so you'll need to pull it out. ``tar
  157. xzf dist/Django-<version>.tar.gz Django-<version>/PKG-INFO`` ought to
  158. work. *FIXME: Is there any reason to pull this file out manually rather than
  159. using "python setup.py register"?*
  160. #. Go to the `Add release page in the admin`__, enter the new release number
  161. exactly as it appears in the name of the tarball (Django-<version>.tar.gz).
  162. __ https://www.djangoproject.com/admin/releases/release/add/
  163. #. Make the blog post announcing the release live.
  164. #. For a new version release (e.g. 1.5, 1.6), update the default stable version
  165. of the docs by flipping the ``is_default`` flag to ``True`` on the
  166. appropriate ``DocumentRelease`` object in the ``docs.djangoproject.com``
  167. database (this will automatically flip it to ``False`` for all
  168. others). *FIXME: I had to do this via fab managepy:shell,docs but we should
  169. probably make it possible to do via the admin.*
  170. #. Post the release announcement to the django-announce,
  171. django-developers and django-users mailing lists. This should
  172. include links to both the announcement blog post and the release
  173. notes. *FIXME: make some templates with example text*.
  174. Post-release
  175. ============
  176. You're almost done! All that's left to do now is:
  177. #. Update the ``VERSION`` tuple in ``django/__init__.py`` again,
  178. incrementing to whatever the next expected release will be. For
  179. example, after releasing 1.2.1, update ``VERSION`` to report "1.2.2
  180. pre-alpha". *FIXME: Is this correct? Do we still do this?*
  181. #. For the first alpha release of a new version (when we create the
  182. ``stable/1.?.x`` git branch), you'll want to create a new
  183. ``DocumentRelease`` object in the ``docs.djangoproject.com`` database for
  184. the new version's docs, and update the ``docs/fixtures/doc_releases.json``
  185. JSON fixture. *FIXME: what is the purpose of maintaining this fixture?*
  186. #. Add the release in `Trac's versions list`_ if necessary. Not all versions
  187. are declared; take example on previous releases.
  188. .. _Trac's versions list: https://code.djangoproject.com/admin/ticket/versions
  189. Notes on setting the VERSION tuple
  190. ==================================
  191. Django's version reporting is controlled by the ``VERSION`` tuple in
  192. ``django/__init__.py``. This is a five-element tuple, whose elements
  193. are:
  194. #. Major version.
  195. #. Minor version.
  196. #. Micro version.
  197. #. Status -- can be one of "alpha", "beta", "rc" or "final".
  198. #. Series number, for alpha/beta/RC packages which run in sequence
  199. (allowing, for example, "beta 1", "beta 2", etc.).
  200. For a final release, the status is always "final" and the series
  201. number is always 0. A series number of 0 with an "alpha" status will
  202. be reported as "pre-alpha".
  203. Some examples:
  204. * ``(1, 2, 1, 'final', 0)`` --> "1.2.1"
  205. * ``(1, 3, 0, 'alpha', 0)`` --> "1.3 pre-alpha"
  206. * ``(1, 3, 0, 'beta', 2)`` --> "1.3 beta 2"