'How to not store password in .pypirc?

I'm trying to set up a private Pypi cloud using CloudPypi. And I really don't want store my password in .pypirc. I want to be prompt to type in my password every time I upload a package.

In Python document about .pypirc, it says:

password, that will be used to authenticate. If omitted the user will be prompt to type it when needed.

But how do you "omit" the password here? I tried leaving the password line blank, tried do "password : " or "password : password". None of these works.



Solution 1:[1]

You omit the entire line completely:

[distutils]
index-servers =
    pypi

[pypi]
repository: <repository-url>
username: <username>

This has been tested on Python 3.6.2 and pip 9.0.1

Solution 2:[2]

Omitting password: in .pypirc is broken since setuptools 42.0.2 (Dec 2019), and will not be fixed (see https://github.com/pypa/setuptools/issues/2006 ).

Instead, you should use twine to upload packages. It will prompt for the password if omitted from .pypirc . See https://twine.readthedocs.io

Example:

pip install twine
twine upload -r mypypi dist/* --verbose

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dominic K
Solution 2