.. _how_to_release:

==================================================
How to make a release
==================================================

Update files
============

Update the NEWS.txt and move the old stuff in the HISTORY.txt file.
To update the NEWS.txt file, check all ticket closed for this release
and all commit log messages. Update the ``Theano/doc/index.txt`` *News* section.

Update the "Vision"/"Vision State" in the file
``Theano/doc/introduction.txt``.

Update the file ``.mailmap`` to clean up the list of contributor.

Get a fresh copy of the repository
==================================

Clone the code::

    git clone git@github.com:Theano/Theano.git Theano-0.X

It does not have to be in your PYTHONPATH.

Update the version number
=========================

``Theano/doc/conf.py`` should be updated in the following ways:

 * Change the upper copyright year to the current year if necessary.

Update the year in the ``Theano/LICENSE.txt`` file too, if necessary.

``NEWS.txt`` usually contains the name and date of the release, change them
too.

Update the fallback version in ``theano/version.py``.

Update the code and the documentation for the theano flags
``warn.ignore_bug_before`` to accept the new version. You must modify the
file ``theano/configdefaults.py`` and ``doc/library/config.txt``.

Tag the release
===============

You will need to commit the previous changes, tag the resulting version, and
push that into the original repository. The syntax is something like the
following::

    git commit -m "Modifications for 0.X.Y release" setup.py doc/conf.py NEWS.txt HISTORY.txt theano/configdefaults.py doc/library/config.txt
    git tag -a rel-0.X.Y
    git push
    git push --tags

This will trigger and build and upload of the conda package to the
mila-udem channel.

The documentation will be automatically regenerated in the next few hours.

Generate and upload the package
===============================

On PyPI
-------

Set your umask to ``0022`` to ensure that the package file will be readable from other people.
To check your umask::

    umask

To set your umask::

    umask 0022

Now change ``ISRELEASED`` in ``setup.py`` to ``True``.

Finally, use setuptools to register and upload the release::

    python setup.py register sdist --formats=gztar,zip upload

This command register and uploads the package on pypi.python.org. To be able
to do that, you must register on PyPI (you can create an new account, or use
OpenID), and be listed among the "Package Index Owners" of Theano.

There is a bug in some versions of distutils that raises a
UnicodeDecodeError if there are non-ASCII characters in NEWS.txt. You
would need to change NEWS.txt so it contains only ASCII characters (the
problem usually comes from diacritics in people's names).

On mloss.org (for final releases only)
--------------------------------------

Project page is at http://mloss.org/software/view/241/.
Account jaberg is listed as submitter.

1. log in as jaberg to mloss
2. search for theano and click the logo
3. press 'update this project' on the left and change

  - the version number
  - the download link
  - the description of what has changed

4. press save

Make sure the "what's changed" text isn't too long because it will show up on
the front page of mloss.  You have to indent bullet lines by 4 spaces I think in
the description.

You can "update this project" and save lots of times to get the revision text
right. Just do not change the version number.


Finally
-------

Change ``ISRELEASED`` back to ``False``.

Update documentation server scripts
===================================

The documentation server runs the auto-generation script regularly. It
compiles the latest development version and puts it in 
``$webroot/theano_versions/dev/``. It then checks if the release branch
has been updated and if it has, the release documentation is updated and 
put into ``$webroot/theano/``. Finally, it checks for archived versions in
``$webroot/theano_versions/`` and generates a ``versions.json`` file
on the server that is used to populate the version switcher.

If the release branch has changed, you must update the web server script.
Login to the ``deeplearning.net`` server as the user in charge of 
document generation. In the shell script ``~/bin/updatedocs``, update the
variable ``release`` to the branch name for the current release.

You can also add previous releases to the versions documentation archive.
In the script ``~/bin/updatedocs_versions``, change the variable
``Versions`` to the git tag of the documentation version to generate,
then run the script.


Announce the release
====================

Generate an e-mail from the template in ``EMAIL.txt``, including content
from ``NEWS.txt``.

For final releases, send the e-mail to the following mailing lists:

* theano-users
* theano-announce
* numpy-discussion@scipy.org
* scipy-user@python.org
* G+, Scientific Python: https://plus.google.com/communities/108773711053400791849

For release candidates, only e-mail:

* theano-announce
* theano-dev
* theano-users

For alpha and beta releases, only e-mail:

* theano-dev
* theano-users
