-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·122 lines (103 loc) · 3.66 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
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
import os
from distutils.command.build import build as _build
import numpy as np
from setuptools import Extension, find_packages, setup
if os.name == "nt":
compile_args = {"gcc": ["/Qstd=c99"]}
else:
compile_args = ["-Wno-cpp"]
try:
numpy_include = np.get_include()
except AttributeError:
numpy_include = np.get_numpy_include()
# * ================================= 编译 cython_misc =============================================
def get_cython_misc_extensions():
if os.name == "nt":
compile_args = {"gcc": ["/Qstd=c99"]}
else:
compile_args = ["-Wno-cpp"]
os.makedirs("pretty_tools/datastruct/build/", exist_ok=True)
#! 如果有多个文件,则直接在下面这个列表中添加拓展即可
ext_modules = [
Extension(
name="pretty_tools.datastruct._C_misc",
sources=["pretty_tools/datastruct/src/_C_misc.pyx"],
extra_compile_args=compile_args,
include_dirs=[numpy_include],
)
]
return ext_modules
# * ================================= 编译 cython_bbox =============================================
def get_ext_cythonbbox():
ext_modules_cythonbbox = [
Extension(
name="pretty_tools.datastruct.cython_bbox",
sources=["pretty_tools/datastruct/src/cython_bbox.pyx"],
# extra_compile_args=compile_args,
include_dirs=[numpy_include],
)
]
return ext_modules_cythonbbox
# * ================================= 编译 np_enhance =============================================
def get_ext_numpy_enhance():
ext_modules_np_enhance = [
Extension(
name="pretty_tools.datastruct._C_np_enhance",
sources=["pretty_tools/datastruct/src/_C_np_enhance.pyx"],
# extra_compile_args=compile_args,
include_dirs=[numpy_include],
)
]
return ext_modules_np_enhance
def get_ext_graph_enhance():
ext_modules_graph_enhance = [
Extension(
name="pretty_tools.datastruct._C_graph_enhance",
sources=["pretty_tools/datastruct/src/_C_graph_enhance.pyx"],
# extra_compile_args=compile_args,
include_dirs=[numpy_include],
)
]
return ext_modules_graph_enhance
setup(
name="pretty_tools",
version="0.2.0",
author="Lingfeng Wang",
author_email="[email protected]",
description="A pretty tools",
url="http://git.x-contion.top/lab_share/pretty_tools",
packages=find_packages(),
ext_modules=get_ext_cythonbbox() + get_cython_misc_extensions() + get_ext_numpy_enhance() + get_ext_graph_enhance(),
setup_requires=["setuptools>=18.0", "Cython", "numpy"],
classifiers=[
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
install_requires=[
"Cython",
"numpy",
"seaborn",
"rich",
"rich[jupyter]",
"gpuinfo",
"imagesize",
"iteration_utilities",
"colorlog",
"joblib",
"vispy",
"imgaug", # *图像增强库
"streamlit", # 自动生成网页的工具
],
# py_modules=['dataset', 'message', 'multi_works', 'progress', 'video', 'visualization', 'x_logger'],
extra_compile_args=["-pthread"], # 启动多线程编译
)
""" CPU PyG
pip install torch_geometric
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.2.0+cpu.html
"""
"""
pip install jupyter notebook blackcellmagic
每一个分块都使用 %load_ext blackcellmagic 或者 %%black
"""