-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
executable file
·63 lines (52 loc) · 1.93 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
import glob
import numpy as np
import os
from setuptools import setup, find_namespace_packages
from distutils.extension import Extension
from distutils.util import convert_path
from typing import List, Dict, Any
try:
from Cython.Distutils import build_ext
except ImportError:
use_cython = False
else:
use_cython = True
def parse_requirements(filename):
"""load requirements from a pip requirements file"""
lineiter = (line.strip() for line in open(filename))
return [line for line in lineiter if line and not line.startswith("#")]
cmdclass = {}
ext_modules: List[Extension] = []
include_dirs = [np.get_include()]
extension = ".pyx" if use_cython else ".c"
cython_files = glob.glob("datascope/**/*.pyx")
if use_cython:
cmdclass.update({"build_ext": build_ext})
for filepath in cython_files:
basepath = os.path.splitext(filepath)[0]
modulename = ".".join(basepath.split(os.sep))
sourcepath = basepath + extension
ext_modules.append(Extension(modulename, [sourcepath], include_dirs=include_dirs))
main_ns: Dict[str, Any] = {}
ver_path = convert_path("datascope/version.py")
with open(ver_path) as ver_file:
exec(ver_file.read(), main_ns)
install_requires = parse_requirements("requirements.txt")
extras_require = {"dev": parse_requirements("requirements-dev.txt")}
extras_require_all = set(r for e in extras_require.values() for r in e)
extras_require["complete"] = extras_require_all
setup(
name="datascope",
version=main_ns["__version__"],
packages=find_namespace_packages(include=["datascope.*"]),
ext_modules=ext_modules,
license="MIT",
author_email="easeml@ds3lab.com",
url="https://ease.ml/datascope/",
description="Measuring data importance over ML pipelines using the Shapley value.",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
install_requires=install_requires,
extras_require=extras_require,
cmdclass=cmdclass,
)