Skip to content

PyPI Publishing

Greg Annandale edited this page May 9, 2022 · 2 revisions

Setting up PyPI tokens:

  1. Log in to both https://test.pypi.org/ and https://pypi.org/
  2. Generate API tokens for each (use your name for the token name)
  3. Create ~/.pypirc and place into it the following (pasting in the tokens from the step above):
[pypi]
username = __token__
password = pypi-AgEIcH...

[testpypi]
username = __token__
password = pypi-AgENdG...

Uploading to PyPI:

  1. Ensure the package version is bumped up as appropriate.
  2. Build: python setup.py sdist bdist_wheel (you may need to pip install wheel first)
  3. Test the build: python3 -m twine check dist/*
  4. Upload to PyPI Test: python3 -m twine upload --repository testpypi dist/*
  5. Check the package at the URL supplied
  6. Upload to PyPI: python3 -m twine upload dist/*
Clone this wiki locally