I have pip
installed pypirc
and set up a ~/.pypirc
file with the requisite password. Why is twine
asking for a password each time python setup.py
is invoked?
$twine upload --repository-url https://test.pypi.org/legacy/ dist/*
Enter your username:
Here is the form of the .pypirc
[distutils] # this tells distutils what package indexes you can push to
index-servers =
pypi
pypitest
[pypi]
repository: https://pypi.python.org/pypi
username: myuser
password: mypwd
[pypitest]
repository: https://testpypi.python.org/pypi
username: myuser
password: mypwd
Update Not including the --repository-url
gives:
UploadToDeprecatedPyPIDetected: You're trying to upload to the legacy PyPI site 'https://pypi.python.org/pypi'. Uploading to those sites is deprecated.
The new sites are pypi.org and test.pypi.org. Try using https://upload.pypi.org/legacy/ (or https://test.pypi.org/legacy/) to upload your packages instead. These are the default URLs for Twine now.
More at https://packaging.python.org/guides/migrating-to-pypi-org/ .
twine upload dist/*
or
twine upload -r pypi dist/*
or
twine upload -r pypitest dist/*
As far as I understand twine --repository-url <url>
doesn't even consult ~/.pypirc
. With -r <name>
it lookups ~/.pypirc
for the URL, user name and password. If you omit -r <name>
, twine uses the first repo from ~/.pypirc
.