Skip to content

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

Guillaume Chevalier edited this page Jul 22, 2022 · 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. The tag needs to be on a commit that is in the master. Otherwise, please open a pull request to master for it to be accepted.
  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 to the ORIGIN of the repo (not your own fork). You'll need admin priviledges for this. Don't commit the temporary HTML removals that were done in the README, thought.
  7. Draft a new release here using the newly pushed tag, and using as release title the tag number. Ideally also add a description of the changes by checking what change in the corresponding milestone.
  8. Ensure that the new version number on PyPI fits the uploaded one. Enjoy!

Cleaning up

You should run this to clean your local repo of the build to avoid any possible conflicts when deploying next:

rm -rf build/
rm -rf dist/
rm -rf .eggs/
rm -rf neuraxle.egg-info/

Add to conda-forge

Also maintain this file such as incrementing version number: https://github.com/Neuraxio/staged-recipes/blob/master/recipes/neuraxle/meta.yaml

And open a PR to conda-forge's main repo, as explained here: https://conda-forge.org/

Clone this wiki locally