setup.py 5.3 KB

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