2016-04-29 27 views
1

我想製作一個默認安裝依賴項的Python程序包,除非用戶特意表示他們不需要它。Python中的負數extra_requires setup.py

例子:

pip install package[no-django] 

是否當前畫中畫和setup.py機制提供方法來做到這一點或不需要明確extra_requires每次有哪些?

+1

最近我發現是這樣的:https://pythonhosted.org/setuptools/setuptools.html#dynamic-discovery-of-services-and-plugins – Rebs

+0

@Rebs:你的鏈接壞了,我想更新的一個在這裏http://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins對不起,如果我錯了 – cladmi

回答

1

我不認爲這是可能的。變通的辦法是做一個正常的額外要求......其中

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

到處都需要Django的安裝與package[django]安裝。

+0

是的,這是不可能的。 –