This thing drives me nuts. Isn't it possible to simply do something like below?
python setup.py sdist upload --username me --password 1234
Or be promped to enter a password with:
python setup.py sdist upload --username me
Being forced to use my password in clear text in a configuration file goes against everything I ever learned about security. Also not being able to manually enter a username and a password is user unfriendly.
Are Python folks from an other universe? Is there a reason they try to make our lives hard?
A .pypirc file allows you to define the configuration for package indexes (referred to here as “repositories”), so that you don’t have to enter the URL, username, or password whenever you upload a package with twine or flit. The format (originally defined by the distutils package) is:
If you are using a custom PyPI server as a proxy and want to upload some packages there, it’s not easy. For each package, you need to download its source and upload it using setup.py script: You could also download the packages directly into the PyPI’s index directory. If there’s more than one package, you could use a requirements file.
In order to publish a package on PyPI you have to create an account. You can do so by visiting this link. It’s completely free and to sign up you just need to provide your e-mail address, a username and password. Finally, we’ll now use twine in order to upload the created source distribution on PyPI.
For each package, you need to download its source and upload it using setup.py script: You could also download the packages directly into the PyPI’s index directory. If there’s more than one package, you could use a requirements file. But it’s still too much. You should be able to do it with one command.
You can use Twine instead of setup.py
for uploading. This has a number of other advantages. In particular, you can test the files before you upload them. It is invoked like this:
twine upload --username me --password hunter2 dist/whatever.whl
Please note that putting a password on the command line is dangerous. It will likely be recorded in ~/.bash_history
, or your shell's equivalent.
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