forked from uomnlp/tmdm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
83 lines (73 loc) · 2.83 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
"""
Setup script adapted from https://github.com/allenai/allennlp-models/blob/master/setup.py
"""
import shlex
from setuptools import setup, find_packages
import sys
import subprocess
# import os
# version.py defines the VERSION and VERSION_SHORT variables.
VERSION = {}
with open("tmdm/version.py") as version_file:
exec(version_file.read(), VERSION)
# Load requirements.txt
with open("requirements.txt") as requirements_file:
lines = requirements_file.read().splitlines()
install_requirements = []
for line in lines:
if '#egg' in line:
name = line.split("#egg=")[-1]
install_requirements.append(f"{name} @ {line}")
else:
install_requirements.append(line)
from setuptools import setup
from setuptools.command.develop import develop
from setuptools.command.install import install
class PostDevelopCommand(develop):
"""Post-installation for development mode."""
def run(self):
develop.run(self)
subprocess.check_call(shlex.split('python -m spacy download en_core_web_sm'))
class PostInstallCommand(install):
"""Post-installation for installation mode."""
def run(self):
install.run(self)
# PUT YOUR POST-INSTALL SCRIPT HERE or CALL A FUNCTION
subprocess.check_call(shlex.split('python -m spacy download en_core_web_sm'))
# make pytest-runner a conditional requirement,
# per: https://github.com/pytest-dev/pytest-runner#considerations
needs_pytest = {"pytest", "test", "ptr"}.intersection(sys.argv)
pytest_runner = ["pytest-runner"] if needs_pytest else []
setup_requirements = [
# add other setup requirements as necessary
] + pytest_runner
setup(
name="tmdm",
version=VERSION["VERSION"],
description=("Text mining data model with integration of various annotation format"),
long_description=open("README.MD").read(),
long_description_content_type="text/markdown",
classifiers=[
"Intended Audience :: Science/Research",
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3.6",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
],
keywords="allennlp NLP deep learning machine reading semantic parsing parsers",
url="https://github.com/schlevik/tmdm",
author="Viktor Schlegel",
author_email="[email protected]",
license="GPLv3",
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
install_requires=install_requirements,
setup_requires=setup_requirements,
tests_require=["pytest", "flaky", "pytest-cov"],
include_package_data=True,
python_requires=">=3.6",
zip_safe=False,
cmdclass={
'develop': PostDevelopCommand,
'install': PostInstallCommand,
}
)