Anentropic
Anentropic

Reputation: 33863

How to submit a package to PyPI under a different user than my ~/.pypirc

As far as I can tell from the docs, unlike with say git and .gitignore files, setuptools will only look in your $HOME directory for a .pypirc file.

Mostly I am submitting as 'myself', but now I want to submit a specific project via my employer's dev team account.

setup.py register --help doesn't seem to indicate any way to supply a username/password other than the one from my ~/.pypirc

There's the setup.cfg file which could appear in my project root, but it seems that only allows to specify args accepted by the command, so same as above.

Same for .pydistutils.cfg (?)

Surely I can't be the only one - what's the usual way to do this?

Upvotes: 2

Views: 790

Answers (1)

Anentropic
Anentropic

Reputation: 33863

I found a workaround, which is to use https://pypi.python.org/pypi/twine

After installing twine I was able to create a project-specific .pypirc file in the project root, containing the company username/password.

Before using twine you have to generate the package using setup.py though, so the procedure is (from your project root):

$ python setup.py sdist
$ twine register --config-file=./.pypirc dist/*
$ twine upload --config-file=./.pypirc dist/*

Upvotes: 4

Related Questions