-
Notifications
You must be signed in to change notification settings - Fork 8
/
setup_defs.py
104 lines (90 loc) · 3.29 KB
/
setup_defs.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/env python
# encoding: utf-8
"""Definitions and methos used by setup.py and other build-related programs."""
import sys
import os
import re
if sys.version_info < (3, 7):
sys.exit("ERROR: gatenlp requires Python 3.7+")
JARFILE = "gatetools-gatenlpworker-1.0.jar"
JARFILE_DEST = os.path.join(
"_jars", JARFILE
) # where it should be relative to the gatenlp package
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "README.md")) as f:
readme = f.read()
def versionfromfile(*filepath):
infile = os.path.join(here, *filepath)
with open(infile) as fp:
version_match = re.search(
r"^__version__\s*=\s*['\"]([^'\"]*)['\"]", fp.read(), re.M
)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string in {}.".format(infile))
version = versionfromfile("gatenlp/version.py")
def get_install_extras_require():
extras_require = {
"base": ["sortedcontainers>=2.0.0", "iobes"],
"clientibm": ["ibm-watson"],
"clientelg": ["requests", "elg"],
"clienttagme": ["requests"],
"clienttextrazor": ["requests"],
"clientgatecloud": ["requests"],
"clientgooglenlp": ["google-cloud-language"],
"clientperspective": ["google-api-python-client"],
"clients": ["requests", "elg", "ibm-watson", "google-cloud-language", "google-api-python-client"],
"formats": ["msgpack", "pyyaml>=5.2", "beautifulsoup4>=4.9.3", "requests", "conllu", "iobes", ],
"java": ["py4j", "requests"],
"stanza": ["stanza>=1.3.0"],
"spacy": ["spacy>=2.2"],
"nltk": ["nltk>=3.5"],
"mltner": ["tner"],
# the following are not included in all but in alldev
"notebook": [
"ipython",
"ipykernel",
"jupyterlab",
"notebook",
"voila",
"RISE",
"ipywidgets",
],
"ray": ["ray[default]"],
"dev": [
"pytest",
"pytest-pep8",
"pytest-cov",
"pytest-runner",
"sphinx",
"pdoc3",
"tox",
"mypy",
"bandit",
"prospector[with_pyroma,with_vulture,with_mypy,with_bandid,with_frosted]",
# TODO: have to figure out why we need this? Maybe because we added jupyterlab,notebook,voila
"pytest-tornasync",
"flake8",
"black[d]", # for automatic code formatting
"pipreqs", # for dealing with requirements/dependencies
"pip-tools", # for dealing with requirements/dependencies
],
"github": [
"flake8",
"pytest",
"pytest-cov",
"pytest-pep8"
]
}
pck_all = set()
pck_alldev = set()
# NOTE: getting installation problems with tner, excluding mltner until resolved
for name, pcks in extras_require.items():
if name not in ["dev", "notebook", "github", "mltner"]:
pck_all.update(pcks)
if name not in ["github", "mltner"]:
pck_alldev.update(pcks)
pck_all = sorted(list(pck_all))
pck_alldev = sorted(list(pck_alldev))
extras_require.update({"all": pck_all, "alldev": pck_alldev})
return extras_require