In this series about releasing python software, I’ve talked about two things till now:
You’ll need to store your code in a version control system. For svn, you
need an svn structure with
trunk/tags/branches. Those tags (..../yourproject/tags/1.2
) are the
base for your release.
Use setuptools to package your python code. This groups your python code together in one package with a name (“mygreatsoftware”) and a version (“1.2”). And you can make releases (.tar.gz or zip) out of it and optionally upload it to pypi.
With just these two points, the basic idea of releasing boils down to three tasks:
“Tag” the release in your version control system. So svn cp
.../yourproject/trunk .../yourproject/tags/1.2
. See the svn book.
Making the release .tar.gz and possibly uploading it to pypi.
And of course some bookkeeping, like upping your version number in the various places and possibly updating your changelog.
Those tasks are pretty mechanical. I’m lazy, so I automated it. Install
zest.releaser (easy_install
zest.releaser
) and you’re set.
Zest.releaser gives you four commands to help in releasing python packages. The commands must be run in a version controlled checkout. The commands are:
prerelease: asks you for a version number (defaults to the current version minus a ‘dev’ or so), updates the setup.py or version.txt and the HISTORY.txt/CHANGES.txt/CHANGES with this new version number and offers to commit those changes to subversion (or bzr or hg or git).
release: copies the the trunk or branch of the current checkout and creates a version control tag of it.
If you want, it makes a checkout of the tag in a temporary directory and offers to register and upload a source dist of this package to PyPI (Python Package Index).
Note: if the package has not been registered yet, it will not do that for
you. You must register the package manually (python setup.py register
)
so this remains a conscious decision. The main reason is that you want to
avoid having to say: “Oops, I uploaded our client code to the internet; and
this is the initial version with the plaintext root passwords.”
postrelease: asks you for a version number (gives a sane default), adds a development marker to it, updates the setup.py or version.txt and the HISTORY.txt with this and offers to commit those changes to version control.
fullrelease: all of the above in order.
Zest.releaser makes it easy and comfortable to release software. So use it for error-free and hassle-free releases. Zest.releaser makes it easy to do the right thing.
My name is Reinout van Rees and I program in Python, I live in the Netherlands, I cycle recumbent bikes and I have a model railway.
Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):