Here we use the twine tool to do the job, see Twine setup to add and configure it.
python setup.py sdist bdist_wheel
twine upload dist/pyModbusTCP-x.x.x* -r pypitest
Check result at https://test.pypi.org/project/pyModbusTCP/.
twine upload dist/pyModbusTCP-x.x.x* -r pypi
Check result at https://pypi.python.org/project/pyModbusTCP/.
sudo pip install twine
Create ~/.pypirc with credentials for pypi and pypitest.
cat <<EOT >> ~/.pypirc
[distutils]
index-servers =
pypi
pypitest
[pypi]
repository: https://upload.pypi.org/legacy/
username: __token__
password: mytoken
[pypitest]
repository: https://test.pypi.org/legacy/
username: __token__
password: mytoken
EOT
Update it with valid credentials.
nano ~/.pypirc