wiki:PyGammaHowToUploadWheels

Version 2 (modified by flip, 3 years ago) (diff)

--

How To Upload PyGamma Wheels

This document describes how to upload PyGamma wheels to PyPI.

Introduction

As of this writing, uploading wheels requires some help from 3rd party packages.

If you find these steps to be too much trouble, remember that you can always upload the wheel files to scion instead. That would create a small inconvenience for the user.

If the PyGamma wheels are on PyPI, the user can type pip install pygamma and pip will find and install the right version of PyGamma for the user's system.

If the PyGamma wheels are on not PyPI, the user will have to download the correct wheel file for their system and then run pip install pygamma-xxxxx.whl.

Credit

Some of the information in this document comes from here: https://hynek.me/articles/sharing-your-labor-of-love-pypi-quick-and-dirty/

Assumptions

This document assumes the following --

  • You have already built the PyGamma wheels
  • You have an account on the test PyPI
  • You have an account on the production (real) PyPI
  • You have followed the one-time setup steps in this document (see below)

Uploading Wheels

Upload to the test PyPI if you want --

twine upload -r test dist/*

When you feel ready, upload to the production PyPI --

twine upload dist/*

It's perfectly OK to upload just one file, e.g. --

twine upload dist/pygamma-4.3.3-cp27-cp27mu-manylinux1_i686.whl

If twine isn't in your PATH, try using python -m twine instead of just twine.

Changing Metadata

If you change any of the metadata in setup.py (e.g. the description, maintainer email, etc.), you'll need to rerun the setup.py register step for that information to appear on PyPI.

One-time Setup Steps

These are steps that only need to be done once, not every time you upload a wheel.

Install twine

Because Python tools are not where they need to be yet, we need to rely on a 3rd party package called twine. Install it like so --

pip install twine

Create the PyPI Config File

Create the file .pypirc in your home directory and populate it with the text below, replacing the stuff in <angle brackets>.

[distutils]
index-servers=
    pypi
    test

[test]
repository = https://testpypi.python.org/pypi
username = <your test user name goes here>

[pypi]
repository = https://pypi.python.org/pypi
username = <your production user name goes here>

You can also include your password in that file, but that means your password will be stored in plain text on your hard drive. I cannot recommend this.

If you don't put your password in .pypirc, you'll be prompted for it when you run setup.py register or use twine to upload wheels.

Register the Project

Register on the test PyPI first --

python setup.py register -r test

If that goes well, you can register on the production (real) PyPI --

python setup.py register