2

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?

Sam Bobel
  • 1,784
  • 1
  • 15
  • 26
  • [extras] syntax is for including extra stuff. I don't think you can use it to subtract stuff. – wim Jan 10 '18 at 15:58
  • That's unfortunate but makes sense. Is there a way to do conditional manifiests? Also, related: is there a way to access the thing in brackets from inside of setup.py? I could just have different setup functions run for different cases. – Sam Bobel Jan 10 '18 at 16:14
  • Maybe this question could help you: https://stackoverflow.com/questions/19096155/setuptools-and-pip-choice-of-minimal-and-complete-install – matino Jan 10 '18 at 16:22

1 Answers1

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.

wim
  • 338,267
  • 99
  • 616
  • 750