Here we use the twine tool to do the job, see Twine setup to add and configure it.
sudo python setup.py sdisttwine upload dist/pyModbusTCP-x.x.x.tar.gz -r pypitestCheck result at https://test.pypi.org/project/pyModbusTCP/.
twine upload dist/pyModbusTCP-x.x.x.tar.gz -r pypiCheck result at https://pypi.python.org/project/pyModbusTCP/.
sudo pip install twineCreate ~/.pypirc with credentials for pypi and pypitest.
cat <<EOT >> ~/.pypirc
[distutils]
index-servers =
pypi
pypitest
[pypi]
repository: https://upload.pypi.org/legacy/
username: myname
password: mypwd
[pypitest]
repository: https://test.pypi.org/legacy/
username: myname
password: mypwd
EOTUpdate it with valid credentials.
nano ~/.pypirc