Skip to content

Release procedure

mrbean-bremen edited this page Oct 7, 2018 · 24 revisions

The pyfakefs package is released on PyPi.

This article shows how to prepare a release for pyfakefs (for pypi package maintainers or contributors only).

PyPi Procedure

Decide on a new version "M.mm" according to semantic versioning.

On your local computer, clone or pull branch master of pyfakefs. Check out a new branch version-M.mm:

git checkout -b version-M.mm

Edit CHANGES.md with descriptions of the new features and bug fixes.

Make sure that pyfakefs/fake_filesystem.py attribute __version__ is the correct version number:

__version__ = 'M.mm'

Make sure that pyfakefs/docs/conf.py attributes version and release are set correctly:

version = 'M.mm'
release = 'M.mm'

If needed, also adapt the year in the copyright attribute.

Run the tests:

./all_tests.py

Git add, commit.

Push your branch to GitHub:

git push --set-upstream origin version-M.mm

Wait until Travis and Appveyor say your branch passes the tests.

Go to the pyfakefs project on github.com. Create a Pull Request for your release branch.

Wait for Travis and Appveyor to say your pull request passes the tests.

After the tests pass, accept the merge request. Do not delete the branch.

Return to your local computer.

Make sure your ~/.pypirc file looks like this:

[distutils]
index-servers =
    pypi
    pypitest

[pypi]
username:<your username>
password:<your password>

[pypitest]
repository: https://test.pypi.org/legacy/
username:<your username>
password:<your password>

Make sure twine is installed and setuptools and wheel are up-to-date:

pip install twine
pip install -U setuptools
pip install -U wheel

Create a source package and a universal wheel package:

python setup.py sdist bdist_wheel

Release on TestPypi:

twine upload -r pypitest dist/*

Check that pyfakefs is now live on Test PyPi. In particular, try downloading the tarball and examine the CHANGES.md file for the changes in this release.

If all is fine, release on PyPI:

twine upload dist/*

Check again on PyPi.

GitHub Procedure

After releasing on PyPi, also create a release on GitHub so that we have a record of the exact commit that was released.

On GitHub, go to Release.

Choose a version tag of the format vM.mm, where M.mm is the version number. Enter this name.

Choose the release branch version-M.mm. You may wonder why the tag and branch have different names that express the same thing. This is because git tag names and branch names are often in the same name space. With different names, tag vM.mm and branch version-M.mm are easily distinguished.

Explain the contents of the release, and release it!

Adapt Documentation for released version

Make sure you have sphinx installed:

pip install sphinx

Create documentation:

cd pyfakefs/docs  # if pyfakefs is the master branch
make html
cd ../..

Check out the gh-pages branch of pyfakefs alongside the master branch if not done yet:

git clone https://github.com/jmcgeheeiv/pyfakefs -b gh-pages pyfakefs-doc

Copy the generated documentation to the release directory:

cp pyfakefs/gh-pages pyfakefs-doc/release/

Adapt the versions in pyfakefs-doc/index.html.

Prepare master for the next release

Return to branch master:

git checkout master
git pull

Edit pyfakefs/fake_filesystem.py attribute __version__ with the new version number M.nn, where nn=mm+1:

__version__ = 'M.nn'

Edit pyfakefs/docs/conf.py attributes version and release accordingly:

version = 'M.nn'
release = 'M.nndev'

Go to the Appveyor Settings and update the version number there, too.

Edit CHANGES.md, add the template for the upcoming release:

## Version M.nn (as yet unreleased)

#### New Features

#### Infrastructure

#### Fixes

Adapt Documentation for development version

Create documentation:

cd pyfakefs/docs
make html
cd ../..

Copy the generated documentation to the master directory:

cp pyfakefs/gh-pages pyfakefs-doc/master/

Make sure that new documentation files are added in git. Check-in and push the changes to the gh-pages branch. Wait until the documentation is published on GitHub Pages and make sure it is rendered correctly.

Clone this wiki locally