How to I change the Manifest.in depending on the extra_requires I wish to use?

坚强是说给别人听的谎言 提交于 2021-02-10 05:31:09

问题


My problem is that a project I'm working with comes shipped with all of the training data needed to reproduce its results. I want the default installation (pip install package) to include all this stuff, but a specific installation (pip install package[train_only]) to not.

The two ways I want to slim it down are:

  1. Having different manifests for the default and the train_only version, where the default manifest is more inclusive, and

  2. Having different install_requires for each, where the default is more inclusive.

I know how to install extra stuff using extra_requires, but how do I install less?


回答1:


The distribution[extras] syntax is just used for specifying additional dependencies for optional features, this typically means collecting other distributions to install. You can not use this feature to control package data in any way.

Conditional MANIFEST.in and/or package data is unsupported in distutils and setuptools. Your best option would be creating the hooks for a custom post-install script.

If you are willing to consider moving to an "additive" installation model for the extra data instead, you have a nicer option available:

pip install mypackage           # to install without extra training data stuff
pip install mypackage[mystuff]  # to install with extra training data stuff

Then you will create a separate distribution mystuff which will include all of the training data needed.



来源:https://stackoverflow.com/questions/48191319/how-to-i-change-the-manifest-in-depending-on-the-extra-requires-i-wish-to-use

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