1. Tarek Ziadé
  2. distribute
Issue #338 new

Unable to specify custom index for setup_requires requirements.

Jason R. Coombs
created an issue

The setup_requires directive allows specification of requirements to run setup. These dependencies can include plugins for distribute itself (such as pytest-runner which adds the 'ptr' command) or supply file-finder functionality such as hgtools does.

Because this directive adds functionality early in the process, necessarily must run early in the execution of setup(). Thus, it must be run before parameters to easy_install, install, or develop options (which might supply parameters for a custom index, --index-url or similar).

As a result, it's not possible to pass options on the command line to direct setup_requires to be resolved from anything but the default index. Furthermore, if the default cheeseshop is not reachable or the setup_requires package isn't available on the default cheeseshop, a setup_requires directive will prevent setup from running any commands.

There are techniques in which setup_requires can resolve dependencies from another cheeseshop:

  • Install distutils.cfg in the environment-wide library and indicate the index there. This will affect all packages installed into that environment, including setup_requires.
  • Use a local setup.cfg and declare the index_url there. This will affect only the installation of the local project, but it could cause mutation of a SCM-managed file, mutating the working copy. It's even possible to create/configure such a file with the setopt command:
python2.7 -c "import setuptools; setuptools.setup()" setopt -c easy_install -o index-url -s http://mycheese.example.com

There may be other techniques to work around this limitation. If you can think of one, please list it here. I don't believe, however, there is any workaround that can be applied to the command line in question (i.e. while invoking setup.py install).

It would be nice if there was a way to pass parameters (on the command-line) to the easy_install command before setup_requires is invoked.

Comments (4)

  1. Jason R. Coombs reporter

    I should note that this issue also affects pip install of packages that have setup_requires but those requirements are not retrievable from the default cheeseshop.

  2. Jason R. Coombs reporter

    I thought I commented on this already. Maybe my comment got erased.

    It's not a duplicate. It's subtly different. #227 deals with easy_install (and its handling of setup_requires). This ticket specifically addresses invocation of setuptools.setup() (usually via setup.py), which pip also uses.

  3. Log in to comment