How can one manage to install extras_requires with pip when installing from a git repository ?
I know that you can do pip install project[extra]
when the project is on pypi.
And you have to do pip install -e git+https://github.com/user/project.git#egg=project
for a git repo but I didn't manage to find how to link these two options together.
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. and. install_requires.
setup. cfg is a cheekily named Python package which supports providing all of a Python distribution's metadata and build configuration via the setup. cfg file at the base of the distribution's source tree, rather than in the setup.py script. The standard setup.py script is reduced to a stub which uses the setup.
setup.py is a python file, the presence of which is an indication that the module/package you are about to install has likely been packaged and distributed with Distutils, which is the standard for distributing Python Modules. This allows you to easily install Python packages.
The pyproject. toml file was introduced in PEP-518 (2016) as a way of separating configuration of the build system from a specific, optional library (setuptools) and also enabling setuptools to install itself without already being installed.
This should work, per example #6
For remote repos:
pip install -e git+https://github.com/user/project.git#egg=project[extra]
And this for local ones (thanks to @Kurt-Bourbaki):
pip install -e .[extra]
As per @Jurt-Bourbaki:
If you are using zsh
you need to escape square brackets or use quotes:
pip install -e .\[extra\]
# or
pip install -e ".[extra]"
Important to notice: you should not have whitespaces around or within brackets. I.e. this will work: -e ".[extra1,extra2]"
but this won't: -e ". [extra1, extra2]"
- and even as a row in requirements.txt file, where it is not so obvious. The worst thing about it is that when you have whitespace, extras are just silently ignored.
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