forked from dask-contrib/dask-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·131 lines (109 loc) · 3.85 KB
/
setup.py
File metadata and controls
executable file
·131 lines (109 loc) · 3.85 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import os
import shutil
import subprocess
import sys
from setuptools import find_packages, setup
from setuptools.command.build_ext import build_ext as build_ext_orig
from setuptools.command.install_lib import install_lib as install_lib_orig
import versioneer
def install_java_libraries(dir):
"""Helper function to run dask-sql's java installation process in a given directory"""
# build the jar
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", "package", "-f", "pom.xml"]
subprocess.check_call(command, cwd=os.path.join(dir, "planner"))
# copy generated jar to python package
os.makedirs(os.path.join(dir, "dask_sql/jar"), exist_ok=True)
shutil.copy(
os.path.join(dir, "planner/target/DaskSQL.jar"),
os.path.join(dir, "dask_sql/jar/"),
)
class build_ext(build_ext_orig):
"""Build and install the java libraries for an editable install"""
def run(self):
super().run()
# build java inplace
install_java_libraries("")
class install_lib(install_lib_orig):
"""Build and install the java libraries for a standard install"""
def build(self):
super().build()
# copy java source to build directory
self.copy_tree("planner", os.path.join(self.build_dir, "planner"))
# build java in build directory
install_java_libraries(self.build_dir)
# remove java source as it doesn't need to be packaged
shutil.rmtree(os.path.join(self.build_dir, "planner"))
# copy jar to source directory for RTD builds to API docs build correctly
if os.environ.get("READTHEDOCS", "False") == "True":
self.copy_tree(os.path.join(self.build_dir, "dask_sql/jar"), "dask_sql/jar")
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 []
cmdclass = versioneer.get_cmdclass()
cmdclass["build_ext"] = build_ext
cmdclass["install_lib"] = install_lib
setup(
name="dask_sql",
version=versioneer.get_version(),
description="SQL query layer for Dask",
url="https://github.com/dask-contrib/dask-sql/",
maintainer="Nils Braun",
maintainer_email="nilslennartbraun@gmail.com",
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", "sql*.yaml"]},
python_requires=">=3.8",
setup_requires=sphinx_requirements,
install_requires=[
"dask[dataframe,distributed]>=2022.3.0",
"pandas>=1.1.2",
"jpype1>=1.0.2",
"fastapi>=0.69.0",
"uvicorn>=0.11.3",
"tzlocal>=2.1",
"prompt_toolkit",
"pygments",
"tabulate",
"nest-asyncio",
],
extras_require={
"dev": [
"pytest>=6.0.1",
"pytest-cov>=2.10.1",
"mock>=4.0.3",
"sphinx>=3.2.1",
"pyarrow>=3.0.0",
"dask-ml>=2022.1.22",
"scikit-learn>=1.0.0",
"intake>=0.6.0",
"pre-commit",
"black==22.3.0",
"isort==5.7.0",
],
# FIXME: tests are failing with fugue 0.7.0
"fugue": ["fugue[sql]>=0.5.3,<0.7.0"],
},
entry_points={
"console_scripts": [
"dask-sql-server = dask_sql.server.app:main",
"dask-sql = dask_sql.cmd:main",
]
},
zip_safe=False,
cmdclass=cmdclass,
command_options={
"build_sphinx": {
"source_dir": ("setup.py", "docs"),
}
},
)