Allow installation of ML free version.
Add an option to the install script, `--no-ml`, that when given will install Talon without ML support. Fixes #96
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
recursive-include tests *
|
|
||||||
recursive-include talon *
|
|
||||||
recursive-exclude tests *.pyc *~
|
recursive-exclude tests *.pyc *~
|
||||||
recursive-exclude talon *.pyc *~
|
recursive-exclude talon *.pyc *~
|
||||||
include train.data
|
include train.data
|
||||||
|
|||||||
31
setup.py
31
setup.py
@@ -1,4 +1,30 @@
|
|||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
from setuptools.command.install import install
|
||||||
|
|
||||||
|
|
||||||
|
class InstallCommand(install):
|
||||||
|
user_options = install.user_options + [
|
||||||
|
('no-ml', None, "Don't install without Machine Learning modules."),
|
||||||
|
]
|
||||||
|
|
||||||
|
boolean_options = install.boolean_options + ['no-ml']
|
||||||
|
|
||||||
|
def initialize_options(self):
|
||||||
|
install.initialize_options(self)
|
||||||
|
self.no_ml = None
|
||||||
|
|
||||||
|
def finalize_options(self):
|
||||||
|
install.finalize_options(self)
|
||||||
|
if self.no_ml:
|
||||||
|
dist = self.distribution
|
||||||
|
dist.packages=find_packages(exclude=[
|
||||||
|
'tests',
|
||||||
|
'tests.*',
|
||||||
|
'talon.signature',
|
||||||
|
'talon.signature.*',
|
||||||
|
])
|
||||||
|
for not_required in ['numpy', 'scipy', 'scikit-learn==0.16.1']:
|
||||||
|
dist.install_requires.remove(not_required)
|
||||||
|
|
||||||
|
|
||||||
setup(name='talon',
|
setup(name='talon',
|
||||||
@@ -10,7 +36,10 @@ setup(name='talon',
|
|||||||
author_email='admin@mailgunhq.com',
|
author_email='admin@mailgunhq.com',
|
||||||
url='https://github.com/mailgun/talon',
|
url='https://github.com/mailgun/talon',
|
||||||
license='APACHE2',
|
license='APACHE2',
|
||||||
packages=find_packages(exclude=['tests']),
|
cmdclass={
|
||||||
|
'install': InstallCommand,
|
||||||
|
},
|
||||||
|
packages=find_packages(exclude=['tests', 'tests.*']),
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
zip_safe=True,
|
zip_safe=True,
|
||||||
install_requires=[
|
install_requires=[
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
from talon.quotations import register_xpath_extensions
|
from talon.quotations import register_xpath_extensions
|
||||||
from talon import signature
|
try:
|
||||||
|
from talon import signature
|
||||||
|
ML_ENABLED = True
|
||||||
|
except ImportError:
|
||||||
|
ML_ENABLED = False
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
register_xpath_extensions()
|
register_xpath_extensions()
|
||||||
|
if ML_ENABLED:
|
||||||
signature.initialize()
|
signature.initialize()
|
||||||
|
|||||||
Reference in New Issue
Block a user