setup.py 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. # Licensed to the Apache Software Foundation (ASF) under one
  2. # or more contributor license agreements. See the NOTICE file
  3. # distributed with this work for additional information
  4. # regarding copyright ownership. The ASF licenses this file
  5. # to you under the Apache License, Version 2.0 (the
  6. # "License"); you may not use this file except in compliance
  7. # with the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing,
  12. # software distributed under the License is distributed on an
  13. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. # KIND, either express or implied. See the License for the
  15. # specific language governing permissions and limitations
  16. # under the License.
  17. """The script for setting up pydolphinscheduler."""
  18. import logging
  19. import os
  20. import sys
  21. from distutils.dir_util import remove_tree
  22. from os.path import dirname, join
  23. from typing import List
  24. from setuptools import Command, find_packages, setup
  25. if sys.version_info[0] < 3:
  26. raise Exception(
  27. "pydolphinscheduler does not support Python 2. Please upgrade to Python 3."
  28. )
  29. logger = logging.getLogger(__name__)
  30. version = "dev"
  31. # Start package required
  32. prod = [
  33. "boto3>=1.23.10",
  34. "oss2>=2.16.0",
  35. "python-gitlab>=2.10.1",
  36. "click>=8.0.0",
  37. "py4j~=0.10",
  38. "ruamel.yaml",
  39. ]
  40. build = [
  41. "build",
  42. "setuptools>=42",
  43. "wheel",
  44. ]
  45. doc = [
  46. "sphinx>=4.3",
  47. "sphinx_rtd_theme>=1.0",
  48. "sphinx-click>=3.0",
  49. "sphinx-inline-tabs",
  50. "sphinx-copybutton>=0.4.0",
  51. # Unreleased package have a feature we want(use correct version package for API ref), so we install from
  52. # GitHub directly, see also:
  53. # https://github.com/Holzhaus/sphinx-multiversion/issues/42#issuecomment-1210539786
  54. "sphinx-multiversion @ git+https://github.com/Holzhaus/sphinx-multiversion#egg=sphinx-multiversion",
  55. ]
  56. test = [
  57. "pytest>=6.2",
  58. "freezegun>=1.1",
  59. "coverage>=6.1",
  60. "pytest-cov>=3.0",
  61. "docker>=5.0.3",
  62. ]
  63. style = [
  64. "flake8>=4.0",
  65. "flake8-docstrings>=1.6",
  66. "flake8-black>=0.2",
  67. "isort>=5.10",
  68. "autoflake>=1.4",
  69. ]
  70. dev = style + test + doc + build
  71. all_dep = prod + dev
  72. # End package required
  73. def read(*names, **kwargs):
  74. """Read file content from given file path."""
  75. return open(
  76. join(dirname(__file__), *names), encoding=kwargs.get("encoding", "utf8")
  77. ).read()
  78. class CleanCommand(Command):
  79. """Command to clean up python api before setup by running `python setup.py pre_clean`."""
  80. description = "Clean up project root"
  81. user_options: List[str] = []
  82. clean_list = [
  83. "build",
  84. "htmlcov",
  85. "dist",
  86. ".pytest_cache",
  87. ".coverage",
  88. ]
  89. def initialize_options(self) -> None:
  90. """Set default values for options."""
  91. def finalize_options(self) -> None:
  92. """Set final values for options."""
  93. def run(self) -> None:
  94. """Run and remove temporary files."""
  95. for cl in self.clean_list:
  96. if not os.path.exists(cl):
  97. logger.info("Path %s do not exists.", cl)
  98. elif os.path.isdir(cl):
  99. remove_tree(cl)
  100. else:
  101. os.remove(cl)
  102. logger.info("Finish pre_clean process.")
  103. setup(
  104. name="apache-dolphinscheduler",
  105. version=version,
  106. license="Apache License 2.0",
  107. description="Apache DolphinScheduler Python API",
  108. long_description=read("README.md"),
  109. # Make sure pypi is expecting markdown
  110. long_description_content_type="text/markdown",
  111. author="Apache Software Foundation",
  112. author_email="dev@dolphinscheduler.apache.org",
  113. url="https://dolphinscheduler.apache.org/",
  114. python_requires=">=3.6",
  115. keywords=[
  116. "dolphinscheduler",
  117. "workflow",
  118. "scheduler",
  119. "taskflow",
  120. ],
  121. project_urls={
  122. "Homepage": "https://dolphinscheduler.apache.org",
  123. "Documentation": "https://dolphinscheduler.apache.org/python/dev/index.html",
  124. "Source": "https://github.com/apache/dolphinscheduler/tree/dev/dolphinscheduler-python/"
  125. "pydolphinscheduler",
  126. "Issue Tracker": "https://github.com/apache/dolphinscheduler/issues?"
  127. "q=is%3Aissue+is%3Aopen+label%3APython",
  128. "Discussion": "https://github.com/apache/dolphinscheduler/discussions",
  129. "Twitter": "https://twitter.com/dolphinschedule",
  130. },
  131. packages=find_packages(where="src"),
  132. package_dir={"": "src"},
  133. include_package_data=True,
  134. package_data={
  135. "pydolphinscheduler": ["default_config.yaml"],
  136. },
  137. platforms=["any"],
  138. classifiers=[
  139. # complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
  140. "Development Status :: 4 - Beta",
  141. "Environment :: Console",
  142. "Intended Audience :: Developers",
  143. "License :: OSI Approved :: Apache Software License",
  144. "Operating System :: Unix",
  145. "Operating System :: POSIX",
  146. "Operating System :: Microsoft :: Windows",
  147. "Programming Language :: Python",
  148. "Programming Language :: Python :: 3",
  149. "Programming Language :: Python :: 3.6",
  150. "Programming Language :: Python :: 3.7",
  151. "Programming Language :: Python :: 3.8",
  152. "Programming Language :: Python :: 3.9",
  153. "Programming Language :: Python :: 3.10",
  154. "Programming Language :: Python :: 3.11",
  155. "Programming Language :: Python :: Implementation :: CPython",
  156. "Programming Language :: Python :: Implementation :: PyPy",
  157. "Topic :: Software Development :: User Interfaces",
  158. ],
  159. install_requires=prod,
  160. extras_require={
  161. "all": all_dep,
  162. "dev": dev,
  163. "style": style,
  164. "test": test,
  165. "doc": doc,
  166. "build": build,
  167. },
  168. cmdclass={
  169. "pre_clean": CleanCommand,
  170. },
  171. entry_points={
  172. "console_scripts": [
  173. "pydolphinscheduler = pydolphinscheduler.cli.commands:cli",
  174. ],
  175. },
  176. )