Skip to content

Releasing and Packaging

davidplowman edited this page Jul 5, 2022 · 2 revisions

PyPI Packaging

Setting up PyPI tokens:

Log in to both https://test.pypi.org/ and https://pypi.org/

Generate API tokens for each.

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...

Tagging and Releasing

  1. Ensure updates are in main, and the version number in setup.py has been updated
  2. Create a new tag matching the version number: git tag -a vx.x.x
  3. Push the tag: git push --tags
  4. Create a new release https://github.com/raspberrypi/picamera2/releases/new choosing the tag that was just created
  5. Add release notes (eg. from the CHANGELOG), you can also hit the "Auto-generate release notes" button to pull from the commit history

Uploading to PyPI:

  1. Ensure the package version is bumped up as appropriate and that the tag and release have been created (see above)
  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 (pip3 install --index-url https://test.pypi.org/simple/ picamera2)
  6. Upload to PyPI: python3 -m twine upload dist/*
Clone this wiki locally