setup.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. # copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import os
  15. import glob
  16. import itertools
  17. from pathlib import Path
  18. from setuptools import find_packages
  19. from setuptools import setup
  20. def readme():
  21. """get readme"""
  22. with open("README.md", "r", encoding="utf-8") as file:
  23. return file.read()
  24. def dependencies():
  25. """get dependencies"""
  26. with open("requirements.txt", "r") as file:
  27. return file.read()
  28. def version():
  29. """get version"""
  30. with open(os.path.join("paddlex", ".version"), "r") as file:
  31. return file.read().rstrip()
  32. def packages_and_package_data():
  33. """get packages and package_data"""
  34. def _recursively_find(pattern, exts=None):
  35. for dir_ in glob.iglob(pattern):
  36. for root, _, files in os.walk(dir_):
  37. for f in files:
  38. if exts is not None:
  39. ext = os.path.splitext(f)[1]
  40. if ext not in exts:
  41. continue
  42. yield os.path.join(root, f)
  43. pkgs = find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"])
  44. pkg_data = []
  45. for p in itertools.chain(
  46. _recursively_find("paddlex/configs/*", exts=[".yml", ".yaml"]),
  47. ):
  48. if Path(p).suffix in (".pyc", ".pyo"):
  49. continue
  50. pkg_data.append(Path(p).relative_to("paddlex").as_posix())
  51. pipeline_config = [
  52. Path(p).relative_to("paddlex").as_posix()
  53. for p in glob.glob("paddlex/pipelines/*.yaml")
  54. ]
  55. pkg_data.extend(pipeline_config)
  56. pkg_data.append(".version")
  57. pkg_data.append("utils/fonts/PingFang-SC-Regular.ttf")
  58. pkg_data.append("repo_manager/requirements.txt")
  59. return pkgs, {"paddlex": pkg_data}
  60. if __name__ == "__main__":
  61. pkgs, pkg_data = packages_and_package_data()
  62. s = setup(
  63. name="paddlex",
  64. version=version(),
  65. description=("Low-code development tool based on PaddlePaddle."),
  66. long_description=readme(),
  67. author="PaddlePaddle Authors",
  68. author_email="",
  69. install_requires=dependencies(),
  70. packages=pkgs,
  71. package_data=pkg_data,
  72. entry_points={
  73. "console_scripts": [
  74. "paddlex = paddlex.paddlex_cli:main",
  75. ],
  76. },
  77. # PyPI package information
  78. classifiers=[
  79. "Development Status :: 4 - Beta",
  80. "Intended Audience :: Developers",
  81. "Intended Audience :: Education",
  82. "Intended Audience :: Science/Research",
  83. "License :: OSI Approved :: Apache Software License",
  84. "Programming Language :: Python :: 3.8",
  85. "Programming Language :: Python :: 3.9",
  86. "Programming Language :: Python :: 3.10",
  87. "Topic :: Scientific/Engineering",
  88. "Topic :: Scientific/Engineering :: Mathematics",
  89. "Topic :: Scientific/Engineering :: Artificial Intelligence",
  90. "Topic :: Software Development",
  91. "Topic :: Software Development :: Libraries",
  92. "Topic :: Software Development :: Libraries :: Python Modules",
  93. ],
  94. license="Apache 2.0",
  95. keywords=["paddlepaddle"],
  96. )