-
Notifications
You must be signed in to change notification settings - Fork 7
/
pyproject.toml
171 lines (152 loc) · 4.89 KB
/
pyproject.toml
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
[tool.pdm]
[tool.pdm.scripts]
ng_ai-api = {call = "ng_ai.ng_ai_api.__main__:run"}
[tool.pdm.scripts.test]
shell = """
pdm update -dG dev
pytest tests/unit/
"""
[tool.pdm.scripts.lint]
shell = """
pdm update -dG lint
flake8 --max-line-length=84 ng_ai tests
isort --check ng_ai tests --diff
black --line-length 84 --check ng_ai tests --diff
"""
[tool.pdm.scripts.format]
shell = """
pdm update -dG lint
isort ng_ai tests
black --line-length 84 ng_ai tests examples
"""
[tool.pdm.scripts.dockerup]
shell = """
echo "Downloading jar packages for NebulaGraph Algorithm"
mkdir -p tests/integration/setup/download
mkdir -p tests/integration/setup/udf
ALGO_VERSION="3.1.0"
SPARK_C_VERSION="3.4.0"
wget -O tests/integration/setup/download/nebula-algo.jar https://repo1.maven.org/maven2/com/vesoft/nebula-algorithm/$ALGO_VERSION/nebula-algorithm-$ALGO_VERSION.jar
# wget -O tests/integration/setup/download/nebula-spark-connector.jar https://repo1.maven.org/maven2/com/vesoft/nebula-spark-connector/$SPARK_C_VERSION/nebula-spark-connector-$SPARK_C_VERSION.jar
wget -O tests/integration/setup/udf/ng_ai.so https://github.com/wey-gu/nebulagraph-ai/releases/download/0.2.9/ng_ai-ubuntu-2004-nebulagraph-nightly-2023.03.13.so
chmod +x tests/integration/setup/udf/ng_ai.so
echo "Starting NebulaGraph"
docker compose -f 'tests/integration/setup/docker-compose.yaml' up -d --remove-orphans
echo "Waiting for NebulaGraph to start..."
sleep 20
for i in {1..50}; do docker compose -f 'tests/integration/setup/docker-compose.yaml' ps | grep "unhealthy\\|starting" | wc -l | grep -q 0 && break; echo Waiting for another 5 sec; sleep 5; done
echo "NebulaGraph is up and running, removing console container"
docker compose -f 'tests/integration/setup/docker-compose.yaml' stop console
docker compose -f 'tests/integration/setup/docker-compose.yaml' rm -f console
docker compose -f 'tests/integration/setup/docker-compose.yaml' ps
"""
[tool.pdm.scripts.dockerstatus]
shell = """
docker compose -f 'tests/integration/setup/docker-compose.yaml' ps
"""
[tool.pdm.scripts.dockerdown]
shell = """
docker compose -f 'tests/integration/setup/docker-compose.yaml' down
"""
[tool.pdm.scripts.teardown]
shell = """
docker compose -f 'tests/integration/setup/docker-compose.yaml' down
rm -fr tests/integration/setup/download
rm -fr tests/integration/setup/udf
"""
[tool.pdm.scripts.int-test]
shell = """
pdm update -dG dev
pdm run dockerup
mkdir -p tests/integration/setup/build/
echo "Build and Install ng_ai to jupyter_spark, master_spark container"
pdm build --dest tests/integration/setup/build/
docker exec master_spark sh -c 'pip3 uninstall ng_ai -y'
docker exec master_spark sh -c 'pip3 install /root/build/*.whl'
docker restart master_spark
docker exec jupyter_spark sh -c 'pip3 uninstall ng_ai -y'
docker exec jupyter_spark sh -c 'pip3 install /root/build/*.whl'
docker restart jupyter_spark
sleep 7
echo "Run integration tests"
pytest tests/integration/
"""
[tool.black]
line-length = 84
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''
[tool.isort]
profile = "black"
atomic = true
skip_glob = ["*/setup.py"]
filter_files = true
[project]
name = "ng_ai"
version = "0.2.10.3"
description = "NebulaGraph AI Suite"
authors = [
{name = "Wey Gu", email = "[email protected]"},
]
dependencies = [
"flask>=2.0.3",
]
# pyspark for unit test cannot work with python 3.10
requires-python = ">=3.7.1,<3.10"
readme = "README.md"
license = {text = "Apache-2.0"}
classifiers = [
"Topic :: Software Development :: Build Tools",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
[project.urls]
Homepage = "https://github.com/wey-gu/nebulagraph-ai"
Repository = "https://github.com/wey-gu/nebulagraph-ai"
Documentation = "https://github.com/wey-gu/nebulagraph-ai#documentation"
Changelog = "https://github.com/wey-gu/nebulagraph-ai/releases"
[build-system]
requires = ["pdm-pep517>=1.0"]
build-backend = "pdm.pep517.api"
[project.optional-dependencies]
# pyspark 2.4.8 doesn't work with python 3.8+, so we use 3.2.3
spark = ["pyspark>=3.2.3"]
# gensim 4.2.0 doesn't work on m1 mac, 4.3.x requires python 3.8+, so we use 4.1.0
networkx = [
"ng_nx>=0.2.3",
#"pandas>=1.3.5",
#"numpy>=1.21.6",
#"scipy>=1.7.3",
"gensim==4.1.0",
"node2vec>=0.4.3",
"python-louvain>=0.16",
]
jupyter = [
"jupyter_nebulagraph>=0.14.3",
]
all = ["ng_ai[spark,networkx]"]
lint = [
"flake8>=4.0.1",
"black[jupyter]>=23.1.0",
"isort>=5.11.5",
]
test = [
"pytest>=7.2.2",
"chispa>=0.9.2",
"nebula3-python",
]
dev = ["ng_ai[all,lint,test]"]