Skip to content

PyPI Publishing

Greg Annandale edited this page Jan 29, 2024 · 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. Check correct Python version is installed: asdf install
  3. Install requirements: pip install wheel and pip install twine
  4. Build: python setup.py sdist bdist_wheel
  5. Test the build: python3 -m twine check dist/*
  6. Upload to PyPI Test: python3 -m twine upload --repository testpypi dist/*
  7. Check the package at the URL supplied
  8. Upload to PyPI: python3 -m twine upload dist/*
Clone this wiki locally