[Distutils] Support for multiple PyPI publishing identities is rather convoluted

Paul Sokolovsky pmiscml at gmail.com
Sun Jun 1 17:02:18 CEST 2014


Hello,

My usecase is: I work on different projects in parallel, with different
roles. For example, I work on community project and publish packages on
behalf of it, and I publish personal packages too. Obviously, I want to
have 2 separate PyPI publishing accounts for those roles. Also, I don't
want to cleanup after dumb mistakes, so want to explicitly specify an
identity to use for each publishing operation, and get an error if I
don't.

It took me some trial and error to arrive at following .pypirc:

======
[distutils]
index-servers =
    use--repository-switch!
    pfalcon
    micropython-lib

[micropython-lib]
reposytory: http://www.python.org/pypi
username:...
password:...

[pfalcon]
reposytory: http://www.python.org/pypi
username:...
password:...

[use--repository-switch!]
username:foo
password:foo
======

However, using standard 3-fold idiom of "python setup.py sdist register
upload" (suffixed with "-r pfalcon"), it didn't work, throwing random
"Server response (401): basic auth failed". It took me even more trial
and error to figure out that I needed to specify -r after each of
register & upload:

python setup.py sdist register -r pfalcon upload -r pfalcon


So, the questions are: Why so complicated? Am I doing something wrong
and there's easier way to achieve described setup?
(https://docs.python.org/2/distutils/packageindex.html#the-pypirc-file
describes a case of 2 different servers, and that's what I started with,
but it took bunch of attempts to add 3rd "captive" account, and then
make it all work without throwing random errors like "AssertionError:
unsupported schema").


Thanks,
 Paul                          mailto:pmiscml at gmail.com


More information about the Distutils-SIG mailing list