Skip to content

Instantly share code, notes, and snippets.

@Magnus167
Created October 11, 2022 10:52
Show Gist options
  • Select an option

  • Save Magnus167/7e736e69ed5abbdf40fe260be3aeb324 to your computer and use it in GitHub Desktop.

Select an option

Save Magnus167/7e736e69ed5abbdf40fe260be3aeb324 to your computer and use it in GitHub Desktop.
Short guide on publishing to PyPI using twine;

The only dependency that needs to be installed is twine.

Use pip install twine.

In setup.py ensure:

ISRELEASED = True

Then execute the build command (make sure to clean up dist/ beforehand).

python setup.py sdist bdist_wheel

Now to validate if the package is ready to be pushed:

twine check dist/*

There may be a warning message about a missing description(s), which can be ingored. If the package passed the check, then upload by doing:

twine upload dist/*

This will be followed by a propmt for a username and password. If using a token, then use __token__ as username, and the actual token as the password.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment