Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 803
Oddthinking Avatar asked Jul 05 '17 16:07

Oddthinking


People also ask

How do I see dependencies in Python?

Pip Check Command – Check Python Dependencies After Installation. Because pip doesn't currently address dependency issues on installation, the pip check command option can be used to verify that dependencies have been installed properly in your project. For example: $ pip check No broken requirements found.

How do I get all dependencies of a package in Python?

Use the pipdeptree utility to gather a list of all dependencies, create a requirements. txt file listing all the dependencies, and then download them with the pip download command. Get the list of dependencies for a package from the setup.py file.

How do I get dependencies for pip package?

The dependencies of the installed Python packages can be listed using the built-in pip show command. Alternatively the dependencies can be shown as a tree structure using the pipdeptree command. In this note i will show several examples of how to list dependencies of the installed Python packages.


1 Answers

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

like image 197
Ghilas BELHADJ Avatar answered Sep 28 '22 00:09

Ghilas BELHADJ