Optional dependencies for PyPI packages

拜拜、爱过 提交于 2020-01-16 04:50:11

问题


I want to create a new PyPI package, but this will have an special wheels where I will invoke it like this:

pip install misoftware[customer1]

Is this possible?

If so how can I provide patches for [customer1]

For example my main release is:

misoftware==1.1 and

misoftware[customer1]

I want

misoftware[customer1]==1.1.2

This will be 3 wheels total


回答1:


You're describing setuptools 'extras'. This allows you to specify additional dependencies, so for example

  • misoftware just installs the misoftware package
  • misoftware[customer1] would install the misoftware package, plus some extra dependencies

The downside is that the dependencies you list in your extras must be hosted as packages themselves as well on PyPI. So you'd need to create a misoftware_customer1 package, and so on.



来源:https://stackoverflow.com/questions/56998851/optional-dependencies-for-pypi-packages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!