Preparing and uploading new versions to PyPI
Prepare
-
Make sure that the program passes all build checks and is clean and ready for a new release
-
Run
pip3 install -U bump2version setuptools wheel twine
to download and update all required packages -
Bump the program version with
bump2version <type>
where<type>
is eithermajor
,minor
, orpatch
major
= The program functions in an entirely new way, needed the user to change a significant amount of syntax or delete existing generated data to function (this should rarely if ever happen)minor
= There are mainly new additions and minor removals to the program that keep the program pretty much the same but modify some functionalitypatch
= There are mainly fixes to bugs and issues with very few additions / removals -
Create a new entry in
HISTORY.md
with the new version number and list all notable changes to code (not docs, tests, or build files). Include notable bug fixes, improvements, and new or removed features as bullet points using the commit history as a guide:https://github.com/UNCG-DAISY/psi-collect/compare/v<old version>...v<new version>
-
Commit and push changes made by bump2version's updates to the repo along with any other final changes you want to include in the new version, making sure to push the new version tag (e.g.
git push --follow-tags
) -
Make sure build checks pass either by
Travis-CI
or runtox
(pip3 install tox
) locally to be safe
Before You Continue
Travis-CI should automatically build and upload a new package to pypi when a new version tag is created and pushed to the master branch, within a few minutes of the pull request being merged. If this doesn't happen follow the remaining steps, otherwise skip to the validation step!
Build
-
Run
python3 setup.py sdist bdist_wheel
Two new packages should have appeared in a directory called
dist
named something likepsi-collect-<version>.tar.gz
andpsi-collect-<version>-py3-none-any.whl
.If there are no files no response after running commands, try executing all commands mentioned, with
pip
instead ofpip3
andpython
instead ofpython3
. This likely means you don't have Python 2 installed.
Create Access Token
Skip this section if you have a token setup and ready.
-
Login to your account on https://pypi.org/manage/account/token/
-
Create a token with any name and select
Project: psi-collect
under Scope -
Copy the token including
pypi-
Upload
- Run
python3 -m twine upload dist/* --skip-existing
then enter your PyPI access token (includingpypi-
) as the password and__token__
as the username if asked
Validating
-
Visit https://pypi.org/project/psi-collect/ and you should see the latest version on the main page in a few moments
-
Try
pip3 install -U psi-collect
. It may take a few minutes before pip recognizes its existence locally, if it doesn't when you try, make sure you include the-U
and try again after a few minutes. -
Do some basic testing to make sure the commands still work