Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python setup.py install specify extras_require

I have "extras_require" declared in setup.py. Is there a way I can specify optional features with something like python setup.py[extras] install.

I know that pip can handle optional features like:

pip install .[extras]

or

pip install -e .[extras]

Is there something like python setup.py install [extras] or python setup.py develop [extras] that can do the similar things. Or is there another way to tell python setup.py to install some optional requirements.

like image 391
ian xu Avatar asked Aug 12 '19 09:08

ian xu


People also ask

What is Extras_require?

extras_require. A dictionary mapping names of “extras” (optional features of your project) to strings or lists of strings specifying what other distributions must be installed to support those features.

How python setup py install?

Installing Python Packages with Setup.py To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.

Does pip install run setup py?

pip is a package manager, which can install, upgrade, list and uninstall packages, like familiar package managers including: dpkg, apt, yum, urpmi, ports etc. Under the hood, it will run python setup.py install , but with specific options to control how and where things end up installed. In summary: use pip .


1 Answers

python setup.py install easy_install pkg_name[extras]

or

python setup.py develop easy_install pkg_name[extras]

This of course requires pkg_name to already exist in the search paths. It shouldn't install pkg_name a second time since the install/develop option would've already installed it. However the extras will be processed.

The advantage of this over pip install (options) .[extras] is that you can pass specific options to build/install/develop.

like image 174
casper.dcl Avatar answered Oct 23 '22 20:10

casper.dcl