-
Notifications
You must be signed in to change notification settings - Fork 981
/
Copy pathsetup.py
130 lines (110 loc) · 4.29 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
123
124
125
126
127
128
129
130
# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import glob
import itertools
from pathlib import Path
from setuptools import find_packages
from setuptools import setup
def readme():
"""get readme"""
with open("README.md", "r", encoding="utf-8") as file:
return file.read()
def dependencies():
"""get dependencies"""
with open("requirements.txt", "r") as file:
return file.read()
def serving_dependencies():
with open(os.path.join("paddlex", "serving_requirements.txt"), "r") as file:
return file.read()
def paddle2onnx_dependencies():
with open(os.path.join("paddlex", "paddle2onnx_requirements.txt"), "r") as file:
return file.read()
def version():
"""get version"""
with open(os.path.join("paddlex", ".version"), "r") as file:
return file.read().rstrip()
def packages_and_package_data():
"""get packages and package_data"""
def _recursively_find(pattern, exts=None):
for dir_ in glob.iglob(pattern):
for root, _, files in os.walk(dir_):
for f in files:
if exts is not None:
ext = os.path.splitext(f)[1]
if ext not in exts:
continue
yield os.path.join(root, f)
pkgs = find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"])
pkg_data = []
for p in itertools.chain(
_recursively_find("paddlex/configs/*", exts=[".yml", ".yaml"]),
):
if Path(p).suffix in (".pyc", ".pyo"):
continue
pkg_data.append(Path(p).relative_to("paddlex").as_posix())
pipeline_config = [
Path(p).relative_to("paddlex").as_posix()
for p in glob.glob("paddlex/pipelines/*.yaml")
]
pkg_data.append("inference/pipelines/ppchatocrv3/ch_prompt.yaml")
pkg_data.extend(pipeline_config)
pkg_data.append(".version")
pkg_data.append("utils/fonts/PingFang-SC-Regular.ttf")
pkg_data.append("repo_manager/requirements.txt")
pkg_data.append("serving_requirements.txt")
pkg_data.append("paddle2onnx_requirements.txt")
pkg_data.append("hpip_links.html")
return pkgs, {"paddlex": pkg_data}
if __name__ == "__main__":
pkgs, pkg_data = packages_and_package_data()
s = setup(
name="paddlex",
version=version(),
description=("Low-code development tool based on PaddlePaddle."),
long_description=readme(),
author="PaddlePaddle Authors",
author_email="",
install_requires=dependencies(),
extras_require={
"serving": serving_dependencies(),
"paddle2onnx": paddle2onnx_dependencies(),
},
packages=pkgs,
package_data=pkg_data,
entry_points={
"console_scripts": [
"paddlex = paddlex.__main__:console_entry",
],
},
# PyPI package information
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
],
license="Apache 2.0",
keywords=["paddlepaddle"],
)