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:
Automated tagging on git
Create a new ssh key in your repository. Do not push it:
ssh-keygen -t rsa -b 4096 -C "email@example.com"
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.shscript into the repository.
- Decrypt the ssh key in
- Add the deployment instructions.
- Decrypt the ssh key in
- 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-botmaintainer's right on Pypi.
Here are the steps to follow to build and release a Python package. Execute them on each Git repository you want to publish:
Steps to execute
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 pullin every project on the branch
master, and run
make testin each project.
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
Extract strings to translate from source code to
.pot file and update
.po catalog files:
python setup.py extract_messages update_catalog
.po catalog files using poedit for example:
.po files are correct.
Commit modified files if needed:
git commit -am "Update i18n translations"
python setup.py compile_catalog
It should display
Create the release commit
setup.py check the
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.
CHANGELOG.mdfile 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.
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.