问题
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:
Having different manifests for the default and the train_only version, where the default manifest is more inclusive, and
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