Setting up the python package for distribution on PyPI is done using commands through setup.py The following instructions assume you are working from the python directory.
- Commit changes (increment the version in configure.ac file, PyPI will not overwrite a package using the same version)
Update MANIFEST.in to include any additional files then check it to make sure the dist has the right data in it
$ check-manifest --ignore Makefile,PACKAGE.rst,*.cc,tox.ini,tests*,examples*,src*
Lint the code:
$ pylint -f colorized vowpalwabbit
Make sure code passes all tests under supported environments
# install virtualenv if necessary $ pip install virtualenv $ python setup.py test
Create dist folder for package
$ python setup.py sdist
Upload package to PyPI
You should have twine installed and configured and your PyPI / test PyPI user should have access to the package <VERSION> corresponds to the new version in the configure.ac file
- Test package
$ twine upload -r test dist/* $ cd /tmp $ virtualenv test_vw_package $ source test_vw_package/bin/activate $ pip install -i https://testpypi.python.org/simple/ vowpalwabbit $ python -c 'from vowpalwabbit import pyvw' $ deactivate $ rm -rf test_vw_package
- Upload package
$ twine upload dist dist/vowpalwabbit-<VERSION>.tar.gz
Cleanup build and packaging artifacts / directories
$ python setup.py clean