Skip to content

How to deploy a new package (or version of package) to PyPI

Guillaume Chevalier edited this page Jan 16, 2020 · 7 revisions

Credentials

You will need to have a ~/.pypirc file that looks like that somehow, using your PyPI username once you have a PyPI account:

[distutils]
index-servers =
  pypi
  pypitest

[pypi]
repository: https://upload.pypi.org/legacy/
username: guillaume-chevalier

[pypitest]
repository: https://test.pypi.org/legacy/
username: guillaume-chevalier

Build and Upload

  1. Ensure tests and status checks all pass in the master.
  2. Increment version number here so as to fit the next according milestone. Ensure the milestone is complete.
  3. Add a git tag like git tag 0.1.0 on the commit to be released.
  4. Remove the iframe and the sponsors' logo images in the README (because this will crash upon uploading to PyPI: HTML is not supported).
  5. Upload to PyPI:
    • Create package file: python3 setup.py sdist bdist_wheel
    • Test the upload: twine upload -r pypitest dist/neuraxle-0.1.0.tar.gz (note: change the version number)
    • Upload it for real if it worked: twine upload -r pypi dist/neuraxle-0.1.0.tar.gz
  6. Don't forget to push the git tag: git push --tags. Don't commit the temporary HTML removals that were done in the README, thought.
  7. Ensure that the new version number on PyPI fits the uploaded one. Enjoy!

Cleaning up

You can run this to clean your local repo of the build if you want:

rm -rf build/
rm -rf dist/
rm -rf neuraxle.egg-info/
Clone this wiki locally