setup.py 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. "click>=8.0.0",
  34. "py4j~=0.10",
  35. "ruamel.yaml",
  36. ]
  37. build = [
  38. "build",
  39. "setuptools>=42",
  40. "wheel",
  41. ]
  42. doc = [
  43. "sphinx>=4.3",
  44. "sphinx_rtd_theme>=1.0",
  45. "sphinx-click>=3.0",
  46. "sphinx-inline-tabs",
  47. "sphinx-copybutton>=0.4.0",
  48. # Unreleased package have a feature we want(use correct version package for API ref), so we install from
  49. # GitHub directly, see also:
  50. # https://github.com/Holzhaus/sphinx-multiversion/issues/42#issuecomment-1210539786
  51. "sphinx-multiversion @ git+https://github.com/Holzhaus/sphinx-multiversion#egg=sphinx-multiversion",
  52. ]
  53. test = [
  54. "pytest>=6.2",
  55. "freezegun>=1.1",
  56. "coverage>=6.1",
  57. "pytest-cov>=3.0",
  58. "docker>=5.0.3",
  59. ]
  60. style = [
  61. "flake8>=4.0",
  62. "flake8-docstrings>=1.6",
  63. "flake8-black>=0.2",
  64. "isort>=5.10",
  65. "autoflake>=1.4",
  66. ]
  67. dev = style + test + doc + build
  68. all_dep = prod + dev
  69. # End package required
  70. def read(*names, **kwargs):
  71. """Read file content from given file path."""
  72. return open(
  73. join(dirname(__file__), *names), encoding=kwargs.get("encoding", "utf8")
  74. ).read()
  75. class CleanCommand(Command):
  76. """Command to clean up python api before setup by running `python setup.py pre_clean`."""
  77. description = "Clean up project root"
  78. user_options: List[str] = []
  79. clean_list = [
  80. "build",
  81. "htmlcov",
  82. "dist",
  83. ".pytest_cache",
  84. ".coverage",
  85. ]
  86. def initialize_options(self) -> None:
  87. """Set default values for options."""
  88. def finalize_options(self) -> None:
  89. """Set final values for options."""
  90. def run(self) -> None:
  91. """Run and remove temporary files."""
  92. for cl in self.clean_list:
  93. if not os.path.exists(cl):
  94. logger.info("Path %s do not exists.", cl)
  95. elif os.path.isdir(cl):
  96. remove_tree(cl)
  97. else:
  98. os.remove(cl)
  99. logger.info("Finish pre_clean process.")
  100. setup(
  101. name="apache-dolphinscheduler",
  102. version=version,
  103. license="Apache License 2.0",
  104. description="Apache DolphinScheduler Python API",
  105. long_description=read("README.md"),
  106. # Make sure pypi is expecting markdown
  107. long_description_content_type="text/markdown",
  108. author="Apache Software Foundation",
  109. author_email="dev@dolphinscheduler.apache.org",
  110. url="https://dolphinscheduler.apache.org/",
  111. python_requires=">=3.6",
  112. keywords=[
  113. "dolphinscheduler",
  114. "workflow",
  115. "scheduler",
  116. "taskflow",
  117. ],
  118. project_urls={
  119. "Homepage": "https://dolphinscheduler.apache.org",
  120. "Documentation": "https://dolphinscheduler.apache.org/python/index.html",
  121. "Source": "https://github.com/apache/dolphinscheduler/tree/dev/dolphinscheduler-python/"
  122. "pydolphinscheduler",
  123. "Issue Tracker": "https://github.com/apache/dolphinscheduler/issues?"
  124. "q=is%3Aissue+is%3Aopen+label%3APython",
  125. "Discussion": "https://github.com/apache/dolphinscheduler/discussions",
  126. "Twitter": "https://twitter.com/dolphinschedule",
  127. },
  128. packages=find_packages(where="src"),
  129. package_dir={"": "src"},
  130. include_package_data=True,
  131. package_data={
  132. "pydolphinscheduler": ["default_config.yaml"],
  133. },
  134. platforms=["any"],
  135. classifiers=[
  136. # complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
  137. "Development Status :: 4 - Beta",
  138. "Environment :: Console",
  139. "Intended Audience :: Developers",
  140. "License :: OSI Approved :: Apache Software License",
  141. "Operating System :: Unix",
  142. "Operating System :: POSIX",
  143. "Operating System :: Microsoft :: Windows",
  144. "Programming Language :: Python",
  145. "Programming Language :: Python :: 3",
  146. "Programming Language :: Python :: 3.6",
  147. "Programming Language :: Python :: 3.7",
  148. "Programming Language :: Python :: 3.8",
  149. "Programming Language :: Python :: 3.9",
  150. "Programming Language :: Python :: 3.10",
  151. "Programming Language :: Python :: 3.11",
  152. "Programming Language :: Python :: Implementation :: CPython",
  153. "Programming Language :: Python :: Implementation :: PyPy",
  154. "Topic :: Software Development :: User Interfaces",
  155. ],
  156. install_requires=prod,
  157. extras_require={
  158. "all": all_dep,
  159. "dev": dev,
  160. "style": style,
  161. "test": test,
  162. "doc": doc,
  163. "build": build,
  164. },
  165. cmdclass={
  166. "pre_clean": CleanCommand,
  167. },
  168. entry_points={
  169. "console_scripts": [
  170. "pydolphinscheduler = pydolphinscheduler.cli.commands:cli",
  171. ],
  172. },
  173. )