# Release Process

This process describes the steps to execute in order to release a new version of SimPy.

## Preparations

1. Close all tickets for the next version.

2. Update the minium required versions of dependencies in `setup.py`. Update the exact version of all entries in `requirements.txt`.

3. Run tox from the project root. All tests for all supported versions must pass:

       $ tox
       [...]
       ________ summary ________
       py27: commands succeeded
       py32: commands succeeded
       py33: commands succeeded
       pypy: commands succeeded
       congratulations :)

   Note

   Tox will use the `requirements.txt` to setup the venvs, so make sure you’ve updated it!

4. Build the docs (HTML is enough). Make sure there are no errors and undefined references.

       $ cd docs/
       $ make clean html
       $ cd ..

5. Check if all authors are listed in `AUTHORS.txt`.

6. Update the change logs (`CHANGES.txt` and `docs/about/history.rst`). Only keep changes for the current major release in `CHANGES.txt` and reference the history page from there.

7. Commit all changes:

       $ hg ci -m 'Updated change log for the upcoming release.'

8. Update the version number in `simpy/__init__.py` and commit:

       $ hg ci -m 'Bump version from x.y.z to a.b.c'

   Warning

   Do not yet tag and push the changes so that you can safely do a rollback if one of the next step fails and you need change something!

9. Write a draft for the announcement mail with a list of changes, acknowledgements and installation instructions. Everyone in the team should agree with it.

## Build and release

1. Test the release process. Build a source distribution and a wheel package and test them:

       $ python setup.py sdist bdist_wheel
       $ ls dist/
       simpy-a.b.c-py2.py3-none-any.whl simpy-a.b.c.tar.gz

   Try installing them:

       $ rm -rf /tmp/simpy-sdist  # ensure clean state if ran repeatedly
       $ virtualenv /tmp/simpy-sdist
       $ /tmp/simpy-sdist/bin/pip install pytest
       $ /tmp/simpy-sdist/bin/pip install dist/simpy-a.b.c.tar.gz
       $ /tmp/simpy-sdist/bin/python
       >>> import simpy  # doctest: +SKIP
       >>> simpy.__version__  # doctest: +SKIP
       'a.b.c'
       >>> simpy.test()  # doctest: +SKIP

   and

       $ rm -rf /tmp/simpy-wheel  # ensure clean state if ran repeatedly
       $ virtualenv /tmp/simpy-wheel
       $ /tmp/simpy-wheel/bin/pip install pytest
       $ /tmp/simpy-wheel/bin/pip install dist/simpy-a.b.c-py2.py3-none-any.whl
       $ /tmp/simpy-wheel/bin/python
       >>> import simpy  # doctest: +SKIP
       >>> simpy.__version__  # doctest: +SKIP
       'a.b.c'
       >>> simpy.test()  # doctest: +SKIP

2. Create or check your accounts for the test server <https://testpypi.python.org/pypi> and PyPI. Update your `~/.pypirc` with your current credentials:

       [distutils]
       index-servers =
           pypi
           test

       [test]
       repository = https://testpypi.python.org/pypi
       username = <your test user name goes here>
       password = <your test password goes here>

       [pypi]
       repository = http://pypi.python.org/pypi
       username = <your production user name goes here>
       password = <your production password goes here>

3. Upload the distributions for the new version to the test server and test the installation again:

       $ twine upload -r test dist/simpy*a.b.c*
       $ pip install -i https://testpypi.python.org/pypi simpy

4. Check if the package is displayed correctly: https://testpypi.python.org/pypi/simpy

5. Finally upload the package to PyPI and test its installation one last time:

       $ twine upload -r pypi dist/simpy*a.b.c*
       $ pip install -U simpy

6. Check if the package is displayed correctly: https://pypi.python.org/pypi/simpy

## Post release

1. Push your changes:

       $ hg tag a.b.c
       $ hg push ssh://hg@bitbucket.org/simpy/simpy

2. Activate the documentation build for the new version.

3. Send the prepared email to the mailing list and post it on Google+.

4. Update Wikipedia entries.

5. Update Python Wiki

6. Post something to Planet Python (e.g., via Stefan’s blog).