extra_require
is not really supposed to be used this way, it only specifies a dependency.
If you want to provide a custom option, you should write something like this
from setuptools import setup
from setuptools.command.install import install
class InstallCommand(install):
user_options = install.user_options + [
('someopt', None, None), # a 'flag' option
('someval=', None, None) # an option that takes a value
]
def initialize_options(self):
install.initialize_options(self)
self.someopt = None
self.someval = None
def finalize_options(self):
super(InstallCommand, self).finalize_options()
assert self.someopt
assert self.someval == 'asdf'
setup(
name="pkg",
cmdclass={
'install': InstallCommand,
},
)
which can then be used as
./setup.py install --someopt --someval=asdf
or with pip
pip install pkg --install-option='--someopt' --install-option='--someval=asdf'
link, link