PEP: 101 Title: Doing Python Releases 101 Version: $Revision$ Last-Modified: $Date$ Author: Barry Warsaw , Guido van Rossum Status: Active Type: Informational Content-Type: text/x-rst Created: 22-Aug-2001 Post-History: Replaces: 102 Abstract ======== Making a Python release is a thrilling and crazy process. You've heard the expression "herding cats"? Imagine trying to also saddle those purring little creatures up, and ride them into town, with some of their buddies firmly attached to your bare back, anchored by newly sharpened claws. At least they're cute, you remind yourself. Actually, no that's a slight exaggeration . The Python release process has steadily improved over the years and now, with the help of our amazing community, is really not too difficult. This PEP attempts to collect, in one place, all the steps needed to make a Python release. It is organized as a recipe and you can actually print this out and check items off as you complete them. Things You'll Need ================== As a release manager there are a lot of resources you'll need to access. Here's a hopefully-complete list. * A GPG key. Python releases are digitally signed with GPG; you'll need a key, which hopefully will be on the "web of trust" with at least one of the other release managers. * A bunch of software: * "release.py", the Python release manager's friend. It's in the python/release-tools repo on GitHub. It doesn't pip install or have any sort of install process--you'll have to put it on your path yourself, or just run it with a relative path, or whatever. * "blurb", the Misc/NEWS management tool. The release process currently uses three blurb subcommands: release, merge, and export. Installable via pip3. * "virtualenv". The release script installs Sphinx in a virtualenv when building the docs (for 2.7 and 3.5+). * A fairly complete installation of a recent TeX distribution, such as texlive. You need that for building the PDF docs. * Access to ``dl-files.iad1.psf.io``, the server that hosts download files, and ``docs.iad1.psf.io``, the server that hosts the documentation. You'll be uploading files directly here. * Admin access to ``https://github.com/python/cpython`` * An administrator account on www.python.org, including an "API key". * Write access to the PEP repository. If you're reading this, you probably already have this--the first task of any release manager is to draft the release schedule. But in case you just signed up... sucker! I mean, uh, congratulations! * Posting access to http://blog.python.org, a Blogger-hosted weblog. The RSS feed from this blog is used for the 'Python News' section on www.python.org. * A subscription to the super secret release manager mailing list, which may or may not be called ``python-cabal``. Bug Barry about this. How to Make A Release ===================== Here are the steps taken to make a Python release. Some steps are more fuzzy than others because there's little that can be automated (e.g. writing the NEWS entries). Where a step is usually performed by An Expert, the role of that expert is given. Otherwise, assume the step is done by the Release Manager (RM), the designated person performing the release. The roles and their current experts are: * RM = Release Manager - Ɓukasz Langa (US) - Ned Deily (US) - Larry Hastings (US) - Benjamin Peterson (US) * WE = Windows - Steve Dower * ME = Mac - Ned Deily (US) * DE = Docs - Julien Palard (Central Europe) * IE = Idle Expert - Terry Reedy (US) .. note:: It is highly recommended that the RM contact the Experts the day before the release. Because the world is round and everyone lives in different timezones, the RM must ensure that the release tag is created in enough time for the Experts to cut binary releases. You should not make the release public (by updating the website and sending announcements) before all experts have updated their bits. In rare cases where the expert for Windows or Mac is MIA, you may add a message "(Platform) binaries will be provided shortly" and proceed. XXX: We should include a dependency graph to illustrate the steps that can be taken in parallel, or those that depend on other steps. As much as possible, the release steps are automated and guided by the release script, which is available in a separate repository: https://github.com/python/release-tools We use the following conventions in the examples below. Where a release number is given, it is of the form X.Y.ZaN, e.g. 3.3.0a3 for Python 3.3.0 alpha 3, where "a" == alpha, "b" == beta, "rc" == release candidate. Release tags are named "vX.Y.ZaN". The branch name for minor release maintenance branches is "X.Y". This helps by performing several automatic editing steps, and guides you to perform some manual editing steps. - Log into irc.freenode.net and join the #python-dev channel. You probably need to coordinate with other people around the world. This IRC channel is where we've arranged to meet. - Check to see if there are any showstopper bugs. Go to http://bugs.python.org and look for any open bugs that can block this release. You're looking at the Priority of the open bugs for the release you're making; here are the relevant definitions: release blocker Stops the release dead in its tracks. You may not make any release with any open release blocker bugs. deferred blocker Doesn't block this release, but it will block a future release. You may not make a final or candidate release with any open deferred blocker bugs. critical Important bugs that should be fixed, but which does not block a release. Review the release blockers and either resolve them, bump them down to deferred, or stop the release and ask for community assistance. If you're making a final or candidate release, do the same with any open deferred. - Check the stable buildbots. Go to http://buildbot.python.org/all/#/grid Look at the buildbots for the release you're making. Ignore any that are offline (or inform the community so they can be restarted). If what remains are (mostly) green buildbots, you're good to go. If you have non-offline red buildbots, you may want to hold up the release until they are fixed. Review the problems and use your judgement, taking into account whether you are making an alpha, beta, or final release. - Make a release clone. On a fork of the cpython repository on GitHub, create a release branch within it (called the "release clone" from now on). You can use the same GitHub fork you use for cpython development. Using the standard setup recommended in the Python Developer's Guide, your fork would be referred to as `origin` and the standard cpython repo as `upstream`. You will use the branch on your fork to do the release engineering work, including tagging the release, and you will use it to share with the other experts for making the binaries. - Notify all committers by sending email to python-committers@python.org. Since we're now working with a distributed version control system, there is no need to stop everyone from pushing to the main repo; you'll just work in your own clone. Therefore, there won't be any checkin freezes. However, all committers should know the point at which your release clone was made, as later commits won't make it into the release without extra effort. - Make sure the current branch of your release clone is the branch you want to release from. (``git status``) - Run ``blurb release `` specifying the version number (e.g. ``blurb release 3.4.7rc1``). This merges all the recent news blurbs into a single file marked with this release's version number. - Check the docs for markup errors. cd to the Doc directory and run ``make suspicious``. If any markup errors are found, fix them. - Regenerate Lib/pydoc-topics.py. While still in the Doc directory, run ``make pydoc-topics``. Then copy ``build/pydoc-topics/topics.py`` to ``../Lib/pydoc_data/topics.py``. - Commit your changes to pydoc_topics.py (and any fixes you made in the docs). - Consider running autoconf using the currently accepted standard version in case ``configure`` or other autoconf-generated files were last committed with a newer or older version and may contain spurious or harmful differences. Currently, autoconf 2.69 is our de-facto standard. if there are differences, commit them. - Make sure the SOURCE_URI in ``Doc/tools/extensions/pyspecific.py`` points to the right branch in the git repository (or ``default`` for unstable releases of the default branch). - Bump version numbers via the release script. $ .../release-tools/release.py --bump X.Y.ZaN Reminder: X, Y, Z, and N should be integers. a should be one of "a", "b", or "rc" (e.g. "3.4.3rc1"). For final releases omit the aN ("3.4.3"). For the first release of a new version Z should be 0 ("3.6.0"). This automates updating various release numbers, but you will have to modify a few files manually. If your $EDITOR environment variable is set up correctly, release.py will pop up editor windows with the files you need to edit. It is important to update the Misc/NEWS file, however in recent years, this has become easier as the community is responsible for most of the content of this file. You should only need to review the text for sanity, and update the release date with today's date. - Make sure all changes have been committed. (``release.py --bump`` doesn't check in its changes for you.) - Check the years on the copyright notice. If the last release was some time last year, add the current year to the copyright notice in several places: - README - LICENSE (make sure to change on trunk and the branch) - Python/getcopyright.c - Doc/copyright.rst - Doc/license.rst - PC/python_ver_rc.h sets up the DLL version resource for Windows (displayed when you right-click on the DLL and select Properties). This isn't a C include file, it's a Windows "resource file" include file. - Check with the IE (if there is one ) to be sure that Lib/idlelib/NEWS.txt has been similarly updated. - For a final major release, edit the first paragraph of Doc/whatsnew/X.Y.rst to include the actual release date; e.g. "Python 2.5 was released on August 1, 2003." There's no need to edit this for alpha or beta releases. Note that Andrew Kuchling often takes care of this. - Do a "git status" in this directory. You should not see any files. I.e. you better not have any uncommitted changes in your working directory. - Tag the release for X.Y.ZaN. $ .../release-tools/release.py --tag X.Y.ZaN This executes a `git tag` command with the `-s` option so that the release tag in the repo is signed with your gpg key. When prompted choose the private key you use for signing release tarballs etc. - If this is a final major release, branch the tree for X.Y. This section has not yet been updated for GitHub-based releases! When making a major release (e.g., for 3.2), you must create the long-lived maintenance branch. - Note down the current revision ID of the tree. $ hg identify - First, set the original trunk up to be the next release. $ .../release-tools/release.py --bump 3.3a0 - Edit all version references in the README - Move any historical "what's new" entries from Misc/NEWS to Misc/HISTORY. - Edit Doc/tutorial/interpreter.rst (2 references to '[Pp]ython3x', one to 'Python 3.x', also make the date in the banner consistent). - Edit Doc/tutorial/stdlib.rst and Doc/tutorial/stdlib2.rst, which have each one reference to '[Pp]ython3x'. - Add a new whatsnew/3.x.rst file (with the comment near the top and the toplevel sections copied from the previous file) and add it to the toctree in whatsnew/index.rst. - Update the version number in configure.ac and re-run autoconf. - Update the version numbers for the Windows builds in PC/ and PCbuild/, which have references to python32. $ find PC/ PCbuild/ -type f | xargs sed -i 's/python32/python33/g' $ hg mv -f PC/os2emx/python32.def PC/os2emx/python33.def $ hg mv -f PC/python32stub.def PC/python33stub.def $ hg mv -f PC/python32gen.py PC/python33gen.py - Commit these changes to the default branch. - Now, go back to the previously noted revision and make the maintenance branch *from there*. $ hg update deadbeef # revision ID noted down before $ hg branch 3.2 - When you want to push back your new branch to the main CPython repository, the new branch name must be added to the "allow-branches" hook configuration, which protects against stray named branches being pushed. Login to hg.python.org and edit (as the "hg" user) ``/data/hg/repos/cpython/.hg/hgrc`` to that effect. - Do another "git status" in this directory. You should not see any files. I.e. you better not have any uncommitted changes in your working directory. - For a final major release, Doc/tools/static/switchers.js must be updated in all maintained branches, so that the new maintenance branch is not "dev" anymore and there is a new "dev" version. Also, update Doc/tools/templates/indexsidebar.html in all maintained branches. - Time to build the source tarball. Use the release script to create the source gzip and xz tarballs, documentation tar and zip files, and gpg signature files. $ .../release-tools/release.py --export X.Y.ZaN This can take a while for final releases, and it will leave all the tarballs and signatures in a subdirectory called 'X.Y.ZaN/src', and the built docs in 'X.Y.ZaN/docs' (for final releases). - Now you want to perform the very important step of checking the tarball you just created, to make sure a completely clean, virgin build passes the regression test. Here are the best steps to take:: $ cd /tmp $ tar xvf /path/to/your/release/clone///Python-3.2rc2.tgz $ cd Python-3.2rc2 $ ls (Do things look reasonable?) $ ls Lib (Are there stray .pyc files?) $ ./configure (Loads of configure output) $ make test (Do all the expected tests pass?) If you're feeling lucky and have some time to kill, or if you are making a release candidate or final release, run the full test suite: $ make testall If the tests pass, then you can feel good that the tarball is fine. If some of the tests fail, or anything else about the freshly unpacked directory looks weird, you better stop now and figure out what the problem is. - Push your commits to the remote release branch in your GitHub fork.:: # Do a dry run first. $ git push --dry-run origin $ git push --dry-run --tags origin # Make sure you are pushing to your GitHub fork, *not* to the main # python/cpython repo! $ git push origin $ git push --tags origin - Notify the experts that they can start building binaries. - STOP STOP STOP STOP STOP STOP STOP STOP At this point you must receive the "green light" from other experts in order to create the release. There are things you can do while you wait though, so keep reading until you hit the next STOP. - The WE builds the Windows helpfile, using (in Doc/) % make.bat htmlhelp (on Windows) to create suitable input for HTML Help Workshop in build/htmlhelp. HTML Help Workshop is then fired up on the created python33.hhp file, finally resulting in an python33.chm file. - The WE then generates Windows installer files for each Windows target architecture (for Python 3.3, this means x86 and AMD64). - The WE has one checkout tree per target architecture, and builds the pcbuild.sln project for the appropriate architecture. - PC\icons.mak must have been run with nmake. - The cmd.exe window in which this is run must have Cygwin/bin in its path (at least for x86). - The cmd.exe window must have MS compiler tools for the target architecture in its path (VS 2010 for Python 3.3). - The WE then edits Tools/msi/config.py (a file only present locally) to update full_current_version and sets snapshot to false. Currently for a release config.py looks like:: snapshot=0 full_current_version="3.3.5rc2" certname="Python Software Foundation PCBUILD='PCbuild\\amd64' The last line is only present for the amd64 checkout. - Now the WE runs msi.py with ActivePython or Python with pywin32. The WE checksums the files (``*.msi``, ``*.chm``, ``*-pdb.zip``), uploads them to dl-files.iad1.psf.io together with gpg signature files, and emails you the location and md5sums. - The ME builds Mac installer packages and uploads them to dl-files.iad1.psf.io together with gpg signature files. - scp or rsync all the files built by ``release.py --export`` to your home directory on dl-files.iad1.psf.io. While you're waiting for the files to finish uploading, you can continue on with the remaining tasks. You can also ask folks on #python-dev and/or python-committers to download the files as they finish uploading so that they can test them on their platforms as well. - Now you need to go to dl-files.iad1.psf.io and move all the files in place over there. Our policy is that every Python version gets its own directory, but each directory contains all releases of that version. - On dl-files.iad1.psf.io, cd /srv/www.python.org/ftp/python/X.Y.Z creating it if necessary. Make sure it is owned by group 'downloads' and group-writable. - Move the release .tgz, and .tar.xz files into place, as well as the .asc GPG signature files. The Win/Mac binaries are usually put there by the experts themselves. Make sure they are world readable. They should also be group writable, and group-owned by downloads. - Use ``gpg --verify`` to make sure they got uploaded intact. - If this is a final or rc release: Move the doc zips and tarballs to /srv/www.python.org/ftp/python/doc/X.Y.Z[rcA], creating the directory if necessary, and adapt the "current" symlink in .../doc to point to that directory. Note though that if you're releasing a maintenance release for an older version, don't change the current link. - If this is a final or rc release (even a maintenance release), also unpack the HTML docs to /srv/docs.python.org/release/X.Y.Z[rcA] on docs.iad1.psf.io. Make sure the files are in group "docs" and are group-writeable. If it is a release of a security-fix-only version, tell the DE to build a version with the "version switcher" and put it there. - Let the DE check if the docs are built and work all right. - If this is a final major release: Tell the DE to adapt redirects for docs.python.org/X.Y in the nginx config for docs.python.org, update the `docsbuild-scripts `_ to point to the right stable/development branches, and to install it and make the initial checkout. The Doc's version_switcher.js script also needs to be updated. In general, please don't touch things in the toplevel /srv/docs.python.org/ directory unless you know what you're doing. - Note both the documentation and downloads are behind a caching CDN. If you change archives after downloading them through the website, you'll need to purge the stale data in the CDN like this: $ curl -X PURGE https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.xz You should always purge the cache of the directory listing as people use that to browse the release files: $ curl -X PURGE https://www.python.org/ftp/python/2.7.5/ - For the extra paranoid, do a completely clean test of the release. This includes downloading the tarball from www.python.org. Make sure the md5 checksums match. Then unpack the tarball, and do a clean make test.:: $ make distclean $ ./configure $ make test To ensure that the regression test suite passes. If not, you screwed up somewhere! Now it's time to twiddle the web site. To do these steps, you must have the permission to edit the website. If you don't have that, ask someone on pydotorg@python.org for the proper permissions. (Or ask Ewa, who coordinated the effort for the new newbsite with RevSys.) XXX This is completely out of date for Django-based python.org. This page will probably come in handy: http://docutils.sourceforge.net/docs/user/rst/quickref.html None of the web site updates are automated by release.py. - Log in to http://www.python.org/admin . - If this is the first release for this version (even a new patch version), you'll need to create a "page" for the version. Find the "Pages" section and click on "Add", then fill in the form. Note that the easiest thing is probably to copy fields from an existing Python release "page", editing as you go. There should only be one "page" for a release (e.g. 3.5.0, 3.5.1). Reuse the same page for all pre-releases, changing the version number and the documentation as you go. - If this isn't the first release for a version, open the existing "page" for editing and update it to the new release. Don't save yet! - Now create a new "release" for the release. Currently "Releases" are sorted under "Downloads". Again, the easiest thing is probably to copy fields from an existing Python release "page", editing as you go. The mysterious "Release page" field on the form needs the ID number of the "page" for this version. You can get that by examining the URL for the "change page" form for this version. For example, the URL for editing the "page" for Python 3.5 is: https://www.python.org/admin/pages/page/1232/ The page's ID number is the last field; here it is 1232. - Note that by convention, the "Content" on the page and the "Content" on the release are the same, *except* the "page" has a section on where to download the software. - "Save" the release. - Populate the release with the downloadable files. Your friend and mine, Georg Brandl, made a lovely tool called "add-to-pydotorg.py". You can find it in the "release" tree (next to "release.py"). You run the tool on dl-files.iad1.psf.io, like this: % AUTH_INFO=: python add-to-pydotorg.py This walks the correct download directory for , looks for files marked with , and populates the "Release Files" for the correct "release" on the web site with these files. Note that clears the "Release Files" for the relevant version each time it's run. You may run it from any directory you like, and you can run it as many times as you like if the files happen to change. Keep a copy in your home directory on dl-files and keep it fresh. If new types of files are added to the release (e.g. the web-based installers or redistributable zip files added to Python 3.5) someone will need to update add-to-pydotorg.py so it recognizes these new files. (It's best to update add-to-pydotorg.py when file types are removed, too.) - If this is a final release: - Add the new version to the *Python Documentation by Version* page `https://www.python.org/doc/versions/` and remove the current version from any 'in development' section. - For X.Y.Z, edit all the previous X.Y releases' page(s) to point to the new release. This includes the content field of the `Downloads -> Releases` entry for the release:: Note: Python x.y.m has been superseded by `Python x.y.n `_. And, for those releases having separate release page entries (phasing these out?), update those pages as well, e.g. `download/releases/x.y.z`:: Note: Python x.y.m has been superseded by `Python x.y.n `_. - Update the "Current Pre-release Testing Versions web page". There's a page that lists all the currently-in-testing versions of Python: https://www.python.org/download/pre-releases/ Every time you make a release, one way or another you'll have to update this page: - If you're releasing a version before *x.y.0*, or *x.y.z release candidate N,* you should add it to this page, removing the previous pre-release of version *x.y* as needed. - If you're releasing *x.y.z final*, you need to remove the pre-release version from this page. This is in the "Pages" category on the Django-based website, and finding it through that UI is kind of a chore. However! If you're already logged in to the admin interface (which, at this point, you should be), Django will helpfully add a convenient "Edit this page" link to the top of the page itself. So you can simply follow the link above, click on the "Edit this page" link, and make your changes as needed. How convenient! - Other steps (other update for new web site)?? Now it's time to write the announcement for the mailing lists. This is the fuzzy bit because not much can be automated. You can use an earlier announcement as a template, but edit it for content! - STOP STOP STOP STOP STOP STOP STOP STOP - Have you gotten the green light from the WE? - Have you gotten the green light from the DE? - Once the announcement is ready, send it to the following addresses: python-list@python.org python-announce@python.org python-dev@python.org - Also post the announcement to `The Python Insider blog `_. To add a new entry, go to `your Blogger home page, here. `_ Now it's time to do some cleaning up. These steps are very important! - If the branch is not yet in "security fixes only mode", temporarily disable others' pushes to the branch in the main cpython repo and bypass the normal status checks. Go to the Settings -> Branches page: https://github.com/python/cpython/settings/branches/ and choose the Edit button for the branch you are working on. On the Branch Protection page, check the "Restrict who can push to this branch" box and add yourself. Also, uncheck the "Include administrators" box and save changes. (This step isn't necessary for branches already in "security fixes mode". However, the next step is!) - While you're editing the settings for your branch, you'll also need to uncheck "Require status checks to pass before merging". This temporarily disables requiring CI status checks (Travis, AppVeyor, etc) be run and passed before a revision may be pushed. - Merge your release clone into the main development repo:: # Pristine copy of the upstream repo branch. $ git clone --branch X.Y git@github.com:python/cpython.git merge $ cd merge # Fetch the newly created and signed tag from your repo $ git fetch --tags git@github.com:your-github-id/cpython.git vX.Y.ZaN # Null merge the temporary release branch discarding any changes $ git merge --edit --no-squash -s ours vX.Y.ZaN # Examine and update Misc/NEWS etc as needed. For example, you may # need to move NEWS entries for cherry-picked items. # Commit any changes. $ git commit -m '...' - Do the guided post-release steps with the release script. $ .../release-tools/release.py --done X.Y.ZaN Review and commit these changes. - Commit and push to the main repo.:: # Do a dry run first. $ git push --dry-run $ git push --dry-run --tags # If it looks OK, take the plunge. There's no going back from # this step! $ git push $ git push --tags - If you made temporary changes to the permissions for the branch on GitHub, undo those temporary changes now. https://github.com/python/cpython/settings/branches/ A reminder of changes you may have made: - Uncheck the "Retrict who can push to this branch". (Only necessary if the branch is not in "security-fixes-only mode".) - Check the "Include administrators" box. (Only necessary if the branch is not in "security-fixes-only mode".) - Check the "Require status checks to pass before merging" box. (Always needed.) Save your changes. - You can delete the remote release clone, or simply reuse it for the next release. - Send email to python-committers informing them that the release has been published. - Update any release PEPs (e.g. 361) with the release dates. - Update the tracker at https://bugs.python.org: - Flip all the deferred blocker issues back to release blocker for the next release. - Add version X.Y+1 as when version X.Y enters alpha. - Change non-doc RFEs to version X.Y+1 when version X.Y enters beta. - Update 'behavior' issues from versions that your release make unsupported to the next supported version. - Review open issues, as this might find lurking showstopper bugs, besides reminding people to fix the easy ones they forgot about. What Next? ========== * Verify! Pretend you're a user: download the files from python.org, and make Python from it. This step is too easy to overlook, and on several occasions we've had useless release files. Once a general server problem caused mysterious corruption of all files; once the source tarball got built incorrectly; more than once the file upload process on SF truncated files; and so on. * Rejoice. Drink. Be Merry. Write a PEP like this one. Or be like unto Guido and take A Vacation. You've just made a Python release! Windows Notes ============= Windows has a MSI installer, various flavors of Windows have "special limitations", and the Windows installer also packs precompiled "foreign" binaries (Tcl/Tk, expat, etc). So Windows testing is tiresome but very necessary. Concurrent with uploading the installer, the WE installs Python from it twice: once into the default directory suggested by the installer, and later into a directory with embedded spaces in its name. For each installation, the WE runs the full regression suite from a DOS box, and both with and without -0. For maintenance release, the WE also tests whether upgrade installations succeed. The WE also tries *every* shortcut created under Start -> Menu -> the Python group. When trying IDLE this way, you need to verify that Help -> Python Documentation works. When trying pydoc this way (the "Module Docs" Start menu entry), make sure the "Start Browser" button works, and make sure you can search for a random module (like "random" ) and then that the "go to selected" button works. It's amazing how much can go wrong here -- and even more amazing how often last-second checkins break one of these things. If you're "the Windows geek", keep in mind that you're likely the only person routinely testing on Windows, and that Windows is simply a mess. Repeat the testing for each target architecture. Try both an Admin and a plain User (not Power User) account. Copyright ========= This document has been placed in the public domain. .. Local Variables: mode: indented-text indent-tabs-mode: nil End: