Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I specify PyPI server information such as username and password on the command line instead of using .pypirc?

My .pypirc file:

[distutils]
index-servers =
  pypi
  internal

[pypi]
username:pypiusername
password:pypipasswd

[internal]
repository: http://10.11.12.13:8080
username: ning
password: xxxx

I want to write a script that upload packages but don't want to require a .pypirc file on the machine where it runs. I can specify repository with -r, but is there a way to specify username and password as well? Or Is there an option to pass a different file (e.g --config-file ./my-pypyrc)

like image 743
dividebyzero Avatar asked Jan 30 '15 16:01

dividebyzero


People also ask

Can PyPI be private?

(Yes, you can now host your Python package in GitHub by using private-pypi . ) File system.

What is Pypirc file?

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.

Where are Pypirc files stored?

This file must be placed in $HOME/. pypirc for pip/twine to use it. Keep in mind, pypi.org and test.pypi.org are not integrated, so you'll need to have a separate account created on each site.


1 Answers

I'm flabbergasted that setuptools has no secure way to do this on the command line, but you can use Twine (https://github.com/pypa/twine)

twine upload -u USERNAME -p PASSWORD dist/*
like image 158
mmacvicar Avatar answered Oct 13 '22 16:10

mmacvicar