The most common way to distribute Python modules is using PyPI, the Python Package Index (formerly known as the Cheese shop).
There are tool to build and upload packages is or setuptools. Make sure to use version 0.7 or later.
There are a few alternatives to setuptools: distutils is a tool in the standard library with limited functionality. The downside of both distutils and setuptools is that they use a script rather than a file format to store metadata, and force the developer an end-user to use the same tool to build and install the software. distutils2 (the module will be named `package`) is an attempt to move to a modern packaging system for Python, but has not been included as of Python 3.4.
Credits: These steps are taken from the sphinxcontrib-aafig package.
In order to make a PyPi release, do the following steps:
- Make sure the repository is up-to date.
- Ensure the version is incremented:
setup.pymust be updated
libary/__init__.pymust be updated
doc/changes.rstmust contain a summary of the changes
- Make sure all changes are committed, including the version number changes.
- Tag the sources with
hg tag -m 'Tag mymodule-X.Y' mymodule-X.Yor
git tag mymodule-X.Y.
- Push the code and tag:
git push --tags origin
- Temporarily modify
setup.cfgfile to comment out the variables
tag_build = devand
tag_date = true(do not commit this change).
- Register and upload the new release <codde>python setup.py register sdist upload</code>.
- Generate the documentation with
cd doc; make.
- Upload the new documentation (to PyPi or to github mypackage.wiki repository.