Search code examples
pythonsetuptoolspackagingsetup.py

How can I ask setup.py to list dependencies?


I have a third-party package which has a setup.py file that calls setup() in the standard way, passing test_requires, install_requires and extras_require. (It does not use a requirements.txt file.)

I am running a Windows machine (on Appveyor) and pip install is notoriously poor on Windows with some of the packages. I would like to use Conda.

It seems to me, the ideal way to proceed is:

  1. Ask setup.py to list the dependencies it needs, without taking any action.
  2. Pass that list to conda to install.
  3. Call setup.py with the install or test command, confident that it will check its requirements, and not find anything it needs to install.

I thought python setup.py --requires might do the trick, but it is poorly documented and is returning nothing.

If this a reasonable approach? If so, is there a way of asking setup.py to evaluated its dependencies, and list them without installing them.


Solution

  • python setup.py egg_info will write a package_name.egg-info/requires.txt file which contains the dependencies you want.