From dcee2a8c5cfd227cd13b635b76f89d0c3c00f700 Mon Sep 17 00:00:00 2001 From: batflyer Date: Fri, 3 Aug 2018 13:11:44 -0500 Subject: [PATCH 1/2] Overwriting install in setup.py to also download nltk packages which are required by rnlp. --- setup.py | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index 8a8f5c2..5b00456 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,8 @@ """ from setuptools import setup, find_packages +from setuptools.command.install import install as _install + from codecs import open from os import path @@ -12,20 +14,27 @@ with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() -# rnlp needs a few additional nltk packages to function properly. -import nltk -nltk.download('punkt') -nltk.download('stopwords') -#nltk.download('wordnet') -nltk.download('averaged_perceptron_tagger') -# Import the package and assign metadata as appropriate -import rnlp +# https://stackoverflow.com/questions/26799894/installing-nltk-data-in-setup-py-script +class Install(_install): + """ + Overwriting the base class to additionally install nltk packages. + """ + + def run(self): + _install.do_egg_install(self) + + # Install the additional required nltk packages + import nltk + nltk.download('punkt') + nltk.download('stopwords') + nltk.download('averaged_perceptron_tagger') + setup( name='rnlp', - version=rnlp.__version__, - license=rnlp.__license__, + version='0.3.2', + license='GPL-v3', description='Converts text corpora into a set of relational facts.', long_description=long_description, @@ -61,5 +70,15 @@ 'Tracker': 'https://github.com/starling-lab/rnlp/issues' }, - packages=find_packages(exclude=['tests']) + packages=find_packages(exclude=['tests']), + + cmdclass={'install': Install}, + + install_requires=[ + 'nltk', + 'tqdm', + 'joblib' + ], + + setup_requires=['nltk'] ) From fe821909cd8e4dc2715b01f54f222f44cec51aa2 Mon Sep 17 00:00:00 2001 From: batflyer Date: Fri, 3 Aug 2018 13:13:17 -0500 Subject: [PATCH 2/2] Bumping version number in _rnlp.__init__ to match the update to the setup file. --- rnlp/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rnlp/__init__.py b/rnlp/__init__.py index a44e311..8bca420 100644 --- a/rnlp/__init__.py +++ b/rnlp/__init__.py @@ -64,7 +64,7 @@ __copyright__ = 'Copyright (c) 2017-2018 StARLinG Lab' __license__ = 'GPL-v3' -__version__ = '0.3.1' +__version__ = '0.3.2' __status__ = 'Beta' __maintainer__ = 'Alexander L. Hayes (@batflyer)' __email__ = 'alexander.hayes@utdallas.edu'