-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
54 lines (42 loc) · 1.48 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import os
import re
from setuptools import setup
with open('cf_text_embeddings/version.py', "rt") as f:
version_content = f.read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, version_content, re.M)
if mo:
version_string = mo.group(1)
else:
raise RuntimeError("Unable to find version string")
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# remove multiple spaces because of pypi requirement
README = re.sub(' +', '', README)
with open('requirements.txt') as f:
requirements = f.read().splitlines()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='cf_text_embeddings',
version=version_string,
packages=['cf_text_embeddings'],
include_package_data=True,
license='MIT License',
description='Text Embeddings for ClowdFlows',
long_description=README,
url='https://github.com/xflows/cf_text_embeddings',
author='Roman Orac',
author_email='[email protected]',
install_requires=requirements,
)
def download_nltk_requirements():
try:
import nltk # NLTK should be imported after it is installed
nltk.download('punkt')
except Exception:
print(('Warning: NLTK punkt languages weren\'t downloaded,'
'run: python -m nltk.downloader punkt'))
def post_install():
download_nltk_requirements()
post_install()