forked from GateNLP/python-gatenlp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_defs.py
More file actions
108 lines (94 loc) · 3.19 KB
/
setup_defs.py
File metadata and controls
108 lines (94 loc) · 3.19 KB
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
103
104
105
106
#!/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"],
"clientibm": ["ibm-watson"],
"clientelg": ["requests", "elg"],
"clienttagme": ["requests"],
"clienttextrazor": ["requests"],
"clientgatecloud": ["requests"],
"clientgooglenlp": ["google-cloud-language"],
"clients": ["requests", "elg", "ibm-watson", "google-cloud-language"],
"formats": ["msgpack", "pyyaml>=5.2", "beautifulsoup4>=4.9.3", "requests", "conllu"],
"java": ["py4j"],
"stanza": ["stanza>=1.3.0"],
"spacy": ["spacy>=2.2"],
"nltk": ["nltk>=3.5"],
"gazetteers": ["matchtext", "recordclass"],
# 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
],
"github": [
"flake8",
"pytest",
"pytest-cov",
"pytest-pep8"
]
}
added_all = set()
add_all = []
added_alldev = set()
add_alldev = []
for name, pcks in extras_require.items():
if name not in ["dev", "notebook", "github"]:
for pck in pcks:
if pck not in added_all:
add_all.append(pck)
added_all.add(pck)
elif name not in ["github"]:
for pck in pcks:
if pck not in added_alldev:
add_alldev.append(pck)
added_alldev.add(pck)
add_all.sort()
add_alldev.sort()
extras_require.update({"all": add_all, "alldev": add_alldev})
return extras_require