Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can e.g. pip list the options for extras_require?

I know that I can specify optional dependencies in setup.py via extras_require:

setup(
  name="Foo",
  extras_require={
    'bar':  ["barpy"],
  }
)

Now, is there a way for a user to list the extras my package offers? How else would a user know that it might be cool to install the package via

pip3 install .[bar]

?

like image 962
quazgar Avatar asked Oct 28 '22 21:10

quazgar


1 Answers

You can inspect a project's metadata with the new importlib_metadata:

>>> import importlib_metadata
>>> importlib_metadata.metadata('xonsh').get_all('Provides-Extra')
['linux', 'mac', 'proctitle', 'ptk', 'pygments', 'win']
like image 121
Jason R. Coombs Avatar answered Nov 05 '22 09:11

Jason R. Coombs