howto-release-django.txt 12 KB

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