Releasing a project on PyPI

Caveat! This is mostly me cargo-culting what worked for me. The docs suggest using twine, which I couldn’t get to work.

I’m assuming you’ve got a nice python package, a working setup.py, and are ready to release version 0.1 of foo on pypi:

  1. Register at pypi.python.org and login
  2. Run python setup.py sdist, to generate the foo.egg-info/ directory. Inside should be PKG-INFO.
  3. Run python setup.py bdist_wheel, to generate build/, which can be ignored, and dist/. Inside dist/ are the python wheel (foo-0.1-py2.py3-none-any.whl) and the source distribution (foo-0.1.tar.gz)
  4. Go to the “Package submission” (caution: link is annoying if you aren’t logged in) and upload PKG-INFO.
  5. This will create some pages for you on pypi, like https://pypi.python.org/pypi/foo/0.1, and direct you to a page where you can upload files. Upload the wheel and source distribution and wheel from step 2, and you should be good to go.
  6. Create a clean virtual environment and pip install foo to make sure nothing went wrong!

Note that if you make even a tiny change to anything, you’ll need to upload a new release, so probably make sure you’re happy before you start.