-
Notifications
You must be signed in to change notification settings - Fork 28
/
setup.py
97 lines (74 loc) · 2.48 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
#!/usr/bin/env python
from codecs import open
from os.path import abspath, dirname, join
from subprocess import call
from time import time
from typing import List
from draco import __version__
from setuptools import Command, setup
this_dir = abspath(dirname(__file__))
with open(join(this_dir, "README.md"), encoding="utf-8") as file:
long_description = file.read()
class RunTests(Command):
"""Run all tests."""
description = "run tests"
user_options: List[str] = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
"""Run all tests!"""
print("=> Running Ansunit Tests:")
errno_ansunit = call(["ansunit", "asp/tests.yaml", "-v"])
print("=> Running JS Tests:")
errno_js = call(["yarn", "--cwd", "js", "test"])
print("\n\n=> Running Python Tests:")
start = int(round(time() * 1000))
errno_pytest = call(
[
"pytest",
"tests",
"--cov=draco",
"--cov-report=xml",
"--cov-report=term-missing",
]
)
end = int(round(time() * 1000))
print("\n\n RAN IN: {0} sec".format((end - start) / 1000))
print("\n\n=> Running MyPy:")
errno_mypy = call(["mypy", "draco", "tests", "--ignore-missing-imports"])
print("\n\n=> Running Black:")
errno_mypy = call(["black", "--check", "."])
print("=> Running Prettier:")
errno_prettier = call(["yarn", "--cwd", "js", "lint"])
raise SystemExit(
errno_ansunit + errno_js + errno_pytest + errno_mypy + errno_prettier
)
setup(
name="draco",
version=__version__,
description="Visualization recommendation using constraints",
long_description=long_description,
author="Dominik Moritz, Chenglong Wang",
author_email="[email protected], [email protected]",
license="BSD-3",
url="https://github.com/uwdata/draco",
packages=["draco"],
entry_points={"console_scripts": ["draco=draco.cli:main"]},
install_requires=["clyngor"],
include_package_data=True,
extras_require={
"test": ["coverage", "pytest", "pytest-cov", "black", "ansunit", "mypy"]
},
package_data={
"draco": [
"../asp/*.lp",
"../js/bin/*",
"../js/build/draco.js*",
"../LICENSE",
"../README.md",
]
},
cmdclass={"test": RunTests},
)