Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Negative extra_requires in Python setup.py

I'd like to make a Python package that installs a dependency by default unless the user specially signals they do not want that.

Example:

 pip install package[no-django]

Does current pip and setup.py mechanism provide way to do this or does not need to have explicit extra_requires every time?

like image 840
Mikko Ohtamaa Avatar asked Oct 31 '22 04:10

Mikko Ohtamaa


1 Answers

I don't think this is possible. A way around it is to do a normal extra requires ... where

install_require=[
    # ...
    # no django listed here
],
extras_require={
    'django': ['django'],
}

and install with package[django] everywhere you need django installed.

like image 72
Pykler Avatar answered Nov 15 '22 05:11

Pykler