Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does distutils do with the "requires" metadata?

From the distutils docs:

Dependencies on other Python modules and packages can be specified by supplying the requires keyword argument to setup().

For example the python-gflags distribution uses distutils and specifies a dependency on six:

https://github.com/google/python-gflags/blob/master/setup.py#L43

Yet, unlike setuptools' install_requires deps, installing python-gflags with pip does not actually install the dependency six.

The question is, what does distutils and/or pip actually do with this requires value, if anything? I can see it gets stored in the distribution metadata (you can find the requirement specification as plaintext in the file site-packages/python_gflags-3.1.2.dist-info/METADATA after installation) but that alone seems useless without a consumer.

like image 994
wim Avatar asked May 14 '19 17:05

wim


1 Answers

Going through all usages of requires in distutils I didn't find any meaningful usage except printing this info when running python setup.py --requires. On this setup.py example:

from distutils.core import setup

setup(name='foo', requires=['bar', 'baz'])

It will show:

bar
baz

Source:

elif opt in ('classifiers', 'provides', 'requires',
             'obsoletes'):
    print('\n'.join(value))
like image 138
sanyassh Avatar answered Oct 23 '22 12:10

sanyassh