REP-1030 In addition to some python 2 => 3 fixes, this change bumps the scikit-learn version to latest. The previously pinned version of scikit-learn failed trying to compile all necessary C modules under python 3.7+ due to included header files that weren't compatible with C the API implemented in python 3.7+. Simultaneously, with the restrictive compatibility supported by scikit-learn, it seemed prudent to drop python 2 support altogether. Otherwise, we'd be stuck with python 3.4 as the newest possible version we could support. With this change, tests are currently passing under 3.9.2. Lastly, imports the original training data. At some point, a new version of the training data was committed to the repo but no classifier was trained from it. Using a classifier trained from this new data resulted in most of the tests failing.
65 lines
1.8 KiB
Python
Executable File
65 lines
1.8 KiB
Python
Executable File
from __future__ import absolute_import
|
|
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.24.1"]:
|
|
dist.install_requires.remove(not_required)
|
|
|
|
|
|
setup(name='talon',
|
|
version='1.4.8',
|
|
description=("Mailgun library "
|
|
"to extract message quotations and signatures."),
|
|
long_description=open("README.rst").read(),
|
|
author='Mailgun Inc.',
|
|
author_email='admin@mailgunhq.com',
|
|
url='https://github.com/mailgun/talon',
|
|
license='APACHE2',
|
|
cmdclass={
|
|
'install': InstallCommand,
|
|
},
|
|
packages=find_packages(exclude=['tests', 'tests.*']),
|
|
include_package_data=True,
|
|
zip_safe=True,
|
|
install_requires=[
|
|
"lxml>=2.3.3",
|
|
"regex>=1",
|
|
"numpy",
|
|
"scipy",
|
|
"scikit-learn==0.24.1", # pickled versions of classifier, else rebuild
|
|
"chardet>=1.0.1",
|
|
"cchardet>=0.3.5",
|
|
"cssselect",
|
|
"six>=1.10.0",
|
|
"html5lib",
|
|
"joblib",
|
|
],
|
|
tests_require=[
|
|
"mock",
|
|
"nose>=1.2.1",
|
|
"coverage"
|
|
]
|
|
)
|