forked from reata/sqllineage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
94 lines (86 loc) · 3.15 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
import os
import platform
import shlex
import shutil
import subprocess
from setuptools import find_packages, setup
from setuptools.command.egg_info import egg_info
from sqllineage import NAME, STATIC_FOLDER, VERSION
with open("README.md", "r") as f:
long_description = f.read()
class EggInfoWithJS(egg_info):
"""
egginfo is a hook both for
1) building source code distribution (python setup.py sdist)
2) building wheel distribution (python setup.py bdist_wheel)
3) installing from source code (python setup.py install) or pip install from GitHub
In this step, frontend code will be built to match MANIFEST.in list so that later the static files will be copied to
site-packages correctly as package_data. When building a distribution, no building process is needed at install time
"""
def run(self) -> None:
static_path = os.path.join(NAME, STATIC_FOLDER)
if os.path.exists(static_path) or "READTHEDOCS" in os.environ:
pass
else:
js_path = "sqllineagejs"
use_shell = True if platform.system() == "Windows" else False
subprocess.check_call(
shlex.split("npm install"), cwd=js_path, shell=use_shell
)
subprocess.check_call(
shlex.split("npm run build"), cwd=js_path, shell=use_shell
)
shutil.move(os.path.join(js_path, STATIC_FOLDER), static_path)
super().run()
setup(
name=NAME,
version=VERSION,
author="Reata",
author_email="[email protected]",
description="SQL Lineage Analysis Tool powered by Python",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/reata/sqllineage",
packages=find_packages(exclude=("tests",)),
package_data={"": [f"{STATIC_FOLDER}/*", f"{STATIC_FOLDER}/**/**/*", "data/**/*"]},
include_package_data=True,
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
],
python_requires=">=3.8",
install_requires=[
"sqlparse==0.4.4",
"networkx>=2.4",
"sqlfluff==2.3.5",
"sqlalchemy>=2.0.0",
],
entry_points={"console_scripts": ["sqllineage = sqllineage.cli:main"]},
extras_require={
"ci": [
"bandit",
"black",
"flake8",
"flake8-blind-except",
"flake8-builtins",
"flake8-import-order",
"flake8-logging-format",
"mypy",
"pytest",
"pytest-cov",
"tox",
"twine",
"wheel",
],
"docs": ["Sphinx>=3.2.0", "sphinx_rtd_theme>=0.5.0"],
},
cmdclass={"egg_info": EggInfoWithJS},
)