forked from dask-contrib/dask-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·115 lines (99 loc) · 3.58 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
import distutils
import os
import shutil
import subprocess
import sys
import setuptools.command.build_py
from setuptools import find_packages, setup
class MavenCommand(distutils.cmd.Command):
"""Run the maven build command"""
description = "run the mvn install command"
user_options = []
def initialize_options(self):
"""No options"""
pass
def finalize_options(self):
"""No options"""
pass
def run(self):
"""Run the mvn installation command"""
# We need to explicitely specify the full path to mvn
# for Windows
maven_command = shutil.which("mvn")
if not maven_command:
raise OSError(
"Can not find the mvn (maven) binary. Make sure to install maven before building the jar."
)
command = [maven_command, "clean", "install", "-f", "pom.xml"]
self.announce(f"Running command: {' '.join(command)}", level=distutils.log.INFO)
subprocess.check_call(command, cwd="planner")
# Copy the artifact. We could also make maven do that,
# but in this way we have full control from python
os.makedirs("dask_sql/jar", exist_ok=True)
shutil.copy("planner/target/DaskSQL.jar", "dask_sql/jar/DaskSQL.jar")
class BuildPyCommand(setuptools.command.build_py.build_py):
"""Customize the build command and add the java build"""
def run(self):
"""Run the maven build before the normal build"""
self.run_command("java")
setuptools.command.build_py.build_py.run(self)
long_description = ""
if os.path.exists("README.md"):
with open("README.md") as f:
long_description = f.read()
needs_sphinx = "build_sphinx" in sys.argv
sphinx_requirements = ["sphinx>=3.2.1", "sphinx_rtd_theme"] if needs_sphinx else []
setup(
name="dask_sql",
description="Dask SQL",
url="http://github.com/dask-contrib/dask-sql/",
maintainer="Nils Braun",
maintainer_email="[email protected]",
license="MIT",
long_description=long_description,
long_description_content_type="text/markdown",
packages=find_packages(include=["dask_sql", "dask_sql.*"]),
package_data={"dask_sql": ["jar/DaskSQL.jar"]},
use_scm_version=True,
python_requires=">=3.6",
setup_requires=["setuptools_scm"] + sphinx_requirements,
install_requires=[
"dask[dataframe,distributed]>=2.19.0,!=2021.3.0", # dask 2021.3.0 makes
# dask-ml fail (see https://github.com/dask/dask-ml/issues/803)
"pandas>=1.0.0", # below 1.0, there were no nullable ext. types
"jpype1>=1.0.2",
"fastapi>=0.61.1",
"uvicorn>=0.11.3",
"tzlocal>=2.1",
"prompt_toolkit",
"pygments",
"nest-asyncio",
# backport for python versions without importlib.metadata
"importlib_metadata; python_version < '3.8.0'",
],
extras_require={
"dev": [
"pytest>=6.0.1",
"pytest-cov>=2.10.1",
"mock>=4.0.3",
"sphinx>=3.2.1",
"pyarrow>=0.15.1",
"dask-ml>=1.7.0",
"scikit-learn>=0.24.2",
"intake>=0.6.0",
"pre-commit",
"black==19.10b0",
"isort==5.7.0",
],
"fugue": ["fugue[sql]>=0.5.3"],
},
entry_points={
"console_scripts": [
"dask-sql-server = dask_sql.server.app:main",
"dask-sql = dask_sql.cmd:main",
]
},
zip_safe=False,
cmdclass={"java": MavenCommand, "build_py": BuildPyCommand,},
command_options={"build_sphinx": {"source_dir": ("setup.py", "docs"),}},
)