Release process

Automated releasing

The main openfisca packages (core, france, and web-api) are today continously and automatically released.

When a Pull Request is merged to master, this CI server (travis) automatically:

  • Publish a version tag on github.
  • Publish a release on the PyPI repository.

Set up automated releasing on a new repository

  • Make sure you have installed the Travis CI Command Line Client

  • Log in to Travis CI using your github credentials:

    travis login
    

    Automated tagging on git

  • Create a new ssh key in your repository. Do not push it:

    ssh-keygen -t rsa -b 4096 -C "bot@openfisca.fr"
    
  • Encrypt the private key.

    travis encrypt-file $id_rsa --add
    
  • Add the public key to the repository in Settings > Deploy keys, with writing rights.

  • Copy and adapt the repository name in the release-tag.sh script into the repository.

  • Edit .travis.yaml to:

  • Only push the encrypted key. You can remove both the private and public keys after making sure the automatic tagging works as expected.

Automated releasing on Pypy

  • Make sure you know the credentials for the openfisca-bot Pypi user.

  • Give openfisca-bot maintainer's right on Pypi.

  • Encrypt the openfisca-bot password:

    travis encrypt
    
  • Edit .travis.yaml to:

Deprecated

Manual releasing

Here are the steps to follow to build and release a Python package. Execute them on each Git repository you want to publish:

See also:

Steps to execute

Tests

Open the build-status page to check that the build status of every project is "passing" (green color).

Check that there are no pending tests by clicking on the badges.

If there are errors, click on a badge to open the corresponding Travis page.

You can also execute the tests by yourself: do git pull in every project on the branch master, and run make test in each project.

Internationalization (i18n)

If the project does not use Python-Babel to translate strings, skip this section. Check by looking for the Babel entry in install_requires = of setup.py.

Extract strings to translate from source code to .pot file and update .po catalog files:

python setup.py extract_messages update_catalog

Translate .po catalog files using poedit for example:

poedit /path/to/i18n/fr/LC_MESSAGES/fr.po

Ensure that Project-Id-Version in .pot and .po files are correct.

Commit modified files if needed:

git commit -am "Update i18n translations"

Compile catalog .po files:

python setup.py compile_catalog

It should display (100%) translated.

Create the release commit

In setup.py check the install_requires and version keys.

Each Pull Request introducing a new dependency or a breaking change should have updated the setup.py file, but it's better to check it again.

The same for the CHANGELOG.md file, check that it's OK.

If the CHANGELOG.md file is not enough filled-in, you can use this command to extract some useful commit messages:

git log --pretty=format:"* %s" a..b

Commit changes if you made some.

Then create a release tag:

# Replace X by the actual version number!
git tag X
git push origin master X

Publish on PyPI

Build and upload the package to PyPI:

python setup.py bdist_wheel upload

Test the package installation

Let's check if the package is installable from PyPI without errors using virtualenv:

cd /tmp
virtualenv test-openfisca
cd test-openfisca
source bin/activate
pip install OpenFisca-France
python -m openfisca_france.tests.test_basics
deactivate

Test OpenFisca-Web-API installation if you wish.

Next steps

Do the same for the remaining repositories to release.

When all the suited repositories are released, you can announce the new release on the website news, Twitter, the mailing list, etc.