It is strange that there is no built-in support for the default installation, but there are two options here that can help you get around it.
Option 1: Perhaps the easiest solution would be to leave your ~ / .pypirc script intact and create shell aliases for your internal and public downloads. This can give you more control over customization for your workflow.
Given this .pypirc file:
[distutils] index-servers = pypi internal [pypi] repository: http:
Create shell aliases (put these definitions in your rcfile shell, for example ~ / .bashrc ):
alias ppup_internal='python setup.py bdist_egg sdist upload -r internal' alias ppup_public='python setup.py bdist_egg sdist upload'
Using:
% ppup_internal ... running upload Submitting dist/foo-0.0.0.tar.gz to http://localhost:8080 Server response (200): OK
Option 2: Hack: You can bypass the default settings by setting the default repository name at the top of the setup.py scripts.
from distutils import config config.PyPIRCCommand.DEFAULT_REPOSITORY = 'internal' from setuptools import setup setup( name='foo', ...
Output:
% python setup.py sdist upload ... running upload Submitting dist/foo-0.0.0.tar.gz to http://localhost:8080 Server response (200): OK % python setup.py sdist upload -r pypi ... running upload Submitting dist/foo-0.0.0.tar.gz to http://pypi.python.org/pypi Server response (200): OK
Background:. If you specify the [distutils] switch in .pypirc , the default pypi url for the boot command is when the -r [repo] argument is omitted. The corresponding code is in distutils.config.PyPIRCCommand :
class PyPIRCCommand(Command): DEFAULT_REPOSITORY = 'http://pypi.python.org/pypi' def _read_pypirc(self): if os.path.exists(rc): self.announce('Using PyPI login from %s' % rc) repository = self.repository or self.DEFAULT_REPOSITORY realm = self.realm or self.DEFAULT_REALM
In the old .pypirc format, the [server-login] section was expected, which was much less flexible since it only defines one target repository. This is not a feasible option, as the [pypi] section below will be unusable:
[server-login] repository: http:
Now, by default, distutils will use this target:
% python setup.py sdist upload ... running upload Submitting dist/foo-0.0.0.tar.gz to http://localhost:8080 Server response (200): OK
But you cannot access any other repositories: it uses the properties [server-login] by default:
% python setup.py sdist upload -r pypi ... running upload Submitting dist/foo-0.0.0.tar.gz to http://localhost:8080 Server response (200): OK