Skip to content

Instantly share code, notes, and snippets.

@meganlkm
Created November 10, 2017 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meganlkm/d98a52a236abc475b141e04c1e1d1e58 to your computer and use it in GitHub Desktop.
Save meganlkm/d98a52a236abc475b141e04c1e1d1e58 to your computer and use it in GitHub Desktop.
upload packages to pypi
#!/usr/bin/env bash
## =======================================================================
## ~/.pypirc
## -----------------------------------------------------------------------
# [distutils] # this tells distutils what package indexes you can push to
# index-servers =
# pypi
# pypitest
# [pypi]
# username: your_username
# password: your_password
# [pypitest]
# repository: https://test.pypi.org/legacy/
# username: your_username
# password: your_password
## =======================================================================
## install twine
pip install twine
## your pypi username and password can be stored in
## environment variables if they are not in ~/.pypirc
export TWINE_USERNAME="your_username"
export TWINE_PASSWORD="your_password"
## clean up and build
rm -rf build dist
python setup.py sdist bdist_wheel
## upload to test pypi
twine upload --repository pypitest dist/*
## install from pypi test
pip install --index-url https://test.pypi.org/simple/ package-name
## upload to pypi
twine upload dist/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment