How does one pip install
with all extras? I'm aware that doing something like:
pip install -e .[docs,tests,others]
is an option. But, is it possible to do something like:
pip install -e .[all]
This question is similar to setup.py/setup.cfg install all extras. However, the answer there requires that the setup.cfg
file be edited. Is it possible to do it without modifying setup.py
or setup.cfg
?
You can install modules or packages with the Python package manager (pip). To install a module system wide, open a terminal and use the pip command. If you type the code below it will install the module. That will install a Python module automatically.
Pip relies on package authors to stipulate the dependencies for their code in order to successfully download and install the package plus all required dependencies from the Python Package Index (PyPI).
To pip install more than one Python package, the packages can be listed in line with the same pip install command as long as they are separated with spaces. Here we are installing both scikit-learn and the statsmodel package in one line of code. You can also upgrade multiple packages in one line of code.
pip is the package installer for Python. It is used to install, update, and uninstall various Python packages (libraries).
Is it possible to [install all extras] without modifying setup.py or setup.cfg?
No until the author of the package declares all extras in setup.py. Something like
docs = […]
tests = […]
others = […]
all = docs + tests + others
setup(
…,
extras_require = {
'all': all,
'docs': docs,
'tests': tests,
'others': others,
},
…,
)
I do it this way:
import itertools
extras_require = {
'foo': [],
'bar': [],
}
extras_require['all'] = list(itertools.chain.from_iterable(extras_require.values()))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With