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.
Primarily it is used to store your private token to be used when uploading packages. This means you can easily keep it in one secure place and don’t need to keep retrieving it or typing your password in. Your .pypirc file on windows should be in your $HOME directory.
An alternative way to protecting passwords in Python is hashing. This can be useful if you’re dealing with storing many passwords, such as credentials to a web application (e.g. Flask or Django ).
[global] index = https://username:[email protected]/pypi index-url = https://username:[email protected]/simple cert = /etc/ssl/certs/ca-certificates.crt For each url you'll need each time to specify the same username and password. Username and password become visible in the logs, cause they are part of the url.
To retrieve the password, we just need to use the get_password method with the “servicename” value and username. Once we’ve set the password, it remains stored by our operating system – so if you start a new Python session, you’ll be able to retrieve it just the same.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With